Skip to content

Commit d852ab9

Browse files
authored
ENG-0000 fix(portal,1ui): resolve all remaining typescript and build issues (#466)
## Affected Packages Apps - [x] portal Packages - [x] 1ui - [ ] api - [ ] protocol - [ ] sdk Tools - [ ] tools ## Overview - Stop tsc from checking types of consumed packages - Fix remaining type errors in portal - Make 1ui emit types and the have it be a `composite` library so that the types can be included as references in portal Source: microsoft/TypeScript#38538 (comment) ## Screen Captures If applicable, add screenshots or screen captures of your changes. ## Declaration - [x] I hereby declare that I have abided by the rules and regulations as outlined in the [CONTRIBUTING.md](https://github.com/0xIntuition/intuition-ts/blob/main/CONTRIBUTING.md)
1 parent fc2e334 commit d852ab9

File tree

21 files changed

+44
-34
lines changed

21 files changed

+44
-34
lines changed

apps/portal/app/components/follow/follow-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default function FollowForm({
105105
<div className="w-full bg-neutral-50/5 rounded-lg border border-neutral-300/10 flex-col justify-start items-start inline-flex">
106106
<ActivePositionCard
107107
value={Number(formatBalance(user_assets, 18, 4))}
108-
claimPosition={`${user_assets > '0' ? 'claimFor' : ''}`}
108+
claimPosition={user_assets > '0' ? 'claimFor' : null}
109109
/>
110110
</div>
111111
</div>

apps/portal/app/components/list/activity.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function ActivityItem({
202202
<ClaimRow
203203
claimsFor={activity.claim.for_num_positions}
204204
claimsAgainst={activity.claim.against_num_positions}
205-
amount={+formatBalance(activity.claim.assets_sum, 18, 4)}
205+
tvl={+formatBalance(activity.claim.assets_sum, 18, 4)}
206206
onClick={() => {
207207
if (activity.claim) {
208208
navigate(`${PATHS.CLAIM}/${activity.claim.claim_id}`)

apps/portal/app/components/list/list-identity-card-portal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Button,
44
CurrencyType,
55
Icon,
6-
Identity,
76
Text,
87
TextVariant,
98
TextWeight,
@@ -32,7 +31,7 @@ export const ListIdentityCardPortal: React.FC<ListIdentityCardPortalProps> = ({
3231
style={{ height: '18rem' }}
3332
>
3433
<Avatar
35-
variant={Identity.nonUser as unknown as number}
34+
variant="non-user"
3635
src={imgSrc}
3736
name={displayName}
3837
className="mb-4 w-16 h-16"

apps/portal/app/components/list/save-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default function SaveForm({
123123
<div className="w-full bg-neutral-50/5 rounded-lg border border-neutral-300/10 flex-col justify-start items-start inline-flex">
124124
<ActivePositionCard
125125
value={Number(formatBalance(user_assets, 18, 4))}
126-
claimPosition={`${user_assets > '0' ? 'claimFor' : ''}`}
126+
claimPosition={user_assets > '0' ? 'claimFor' : null}
127127
/>
128128
</div>
129129
</div>

apps/portal/app/components/profile/connections-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface ConnectionsHeaderProps {
2222
variant: ConnectionsHeaderVariantType
2323
subject: IdentityPresenter
2424
predicate: IdentityPresenter
25-
object: IdentityPresenter
25+
object: IdentityPresenter | null
2626
claim_id: string
2727
totalFollowers: number
2828
totalStake: string

apps/portal/app/components/tags/tags-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function TagsModal({
2626
}}
2727
>
2828
<DialogContent className="bg-neutral-950 rounded-xl shadow border border-solid border-black/10 h-[550px] overflow-hidden flex flex-col">
29+
{/* @ts-ignore TODO: jp - userWallet is a required prop. Where should it come from? */}
2930
<TagsForm
3031
identity={identity}
3132
mode={mode}

apps/portal/app/lib/state/store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const addIdentitiesListModalAtom = atom<{
6363
id: null,
6464
})
6565

66+
// @ts-ignore TODO: jp - identity is passed as a prop to atom, but it does not exist in the atom definition
6667
export const saveListModalAtom = atom<{
6768
isOpen: boolean
6869
id: string | null

apps/portal/app/lib/utils/quest.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2+
// @ts-nocheck content-collections folder is not available at build time
13
import { QuestCondition } from '@0xintuition/api'
24

35
import { allQuests, QuestContentType } from 'content-collections'

apps/portal/app/routes/app+/quest+/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { Suspense } from 'react'
22

33
import {
44
formatWalletAddress,
5+
ProfileCardHeader,
56
Separator,
67
Skeleton,
78
Text,
89
} from '@0xintuition/1ui'
9-
import { ProfileCardHeader } from '@0xintuition/1ui/src/components/ProfileCard/components'
1010
import {
1111
GetUserByWalletResponse,
1212
QuestNarrative,

apps/portal/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"build": "remix vite:build --emptyOutDir",
99
"dev": "remix vite:dev",
1010
"start": "NODE_OPTIONS='--import ./instrumentation.server.mjs' PORT=8080 remix-serve ./build/server/index.js",
11-
"lint:fix": "pnpm lint --fix",
12-
"typecheck": "tsc --noEmit -p ./tsconfig.json"
11+
"lint:fix": "pnpm lint --fix"
1312
},
1413
"repository": {
1514
"type": "git",

apps/portal/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
"options": {
1717
"config": "apps/portal/vitest.config.ts"
1818
}
19+
},
20+
"typecheck": {
21+
"dependsOn": ["^build"],
22+
"command": "tsc",
23+
"options": {
24+
"cwd": "apps/portal"
25+
}
1926
}
2027
}
2128
}

apps/portal/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@
2222
"outDir": "./build"
2323
},
2424
"include": ["**/*.ts", "**/*.tsx", "tailwind.config.js"],
25-
"exclude": ["node_modules", "dist", "**/packages/**/*"]
25+
"exclude": ["node_modules", "build", "./.content-collections"],
26+
"references": [
27+
{
28+
"path": "../../packages/1ui"
29+
}
30+
]
2631
}

nx.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"targetDefaults": {
99
"build": {
10-
"dependsOn": ["^build"],
10+
"dependsOn": ["^build", "typecheck"],
1111
"outputs": ["{projectRoot}/dist"],
1212
"cache": true
1313
},
@@ -22,16 +22,6 @@
2222
},
2323
"typecheck": {
2424
"cache": true
25-
},
26-
"@nx/js:tsc": {
27-
"cache": true,
28-
"dependsOn": ["^build"],
29-
"inputs": ["default", "^default"]
30-
},
31-
"@nx/remix:build": {
32-
"cache": true,
33-
"dependsOn": ["^build"],
34-
"inputs": ["default", "^default"]
3525
}
3626
},
3727
"release": {

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
"1ui:lint": "nx lint @0xintuition/1ui",
1111
"1ui:test": "nx test @0xintuition/1ui --reporter=verbose",
1212
"1ui:typecheck": "nx typecheck @0xintuition/1ui",
13-
"portal:dev": "nx dev @0xintuition/portal",
14-
"portal:start": "nx start @0xintuition/portal",
15-
"portal:typecheck": "nx typecheck @0xintuition/portal",
1613
"api:build": "nx build @0xintuition/api",
1714
"api:lint": "nx lint @0xintuition/api",
15+
"portal:dev": "nx dev @0xintuition/portal",
16+
"portal:start": "nx start @0xintuition/portal",
1817
"portal:build": "nx build @0xintuition/portal",
1918
"portal:lint": "nx lint @0xintuition/portal",
2019
"portal:test": "nx test @0xintuition/portal --reporter=verbose",

packages/1ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.3.0",
44
"description": "Design system",
55
"main": "src/index.js",
6+
"types": "src/index.d.ts",
67
"scripts": {
78
"dev": "tsup --watch",
89
"lint:fix": "pnpm lint --fix",

packages/1ui/src/components/ActivePositionCard/ActivePositionCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Tag, TagSize, TagVariant, Text, TextVariant } from '..'
66

77
export interface ActivePositionCardProps
88
extends React.HTMLAttributes<HTMLDivElement> {
9-
claimPosition?: ClaimPositionType
9+
claimPosition?: ClaimPositionType | null
1010
value: number
1111
currency?: CurrencyType
1212
}

packages/1ui/src/components/ClaimPositionRow/ClaimPositionRow.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ interface CommonProps extends React.HTMLAttributes<HTMLDivElement> {
2929
feesAccrued: number
3030
updatedAt?: string
3131
tags?: TagWithValueProps[]
32+
claimsForValue?: number
33+
claimsAgainstValue?: number
3234
}
3335

3436
interface UserVariantProps extends CommonProps {
3537
variant: 'user'
3638
claimsFor?: number
3739
claimsAgainst?: number
38-
claimsForValue?: number
39-
claimsAgainstValue?: number
4040
name: string
4141
avatarSrc: string
4242
walletAddress: string
@@ -46,8 +46,6 @@ interface ClaimVariantProps extends CommonProps {
4646
variant: 'claim'
4747
claimsFor: number
4848
claimsAgainst: number
49-
claimsForValue: number
50-
claimsAgainstValue: number
5149
name?: never
5250
avatarSrc?: never
5351
walletAddress?: never

packages/1ui/src/components/ClaimRow/ClaimRow.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { CurrencyType } from 'types'
77
export interface ClaimRowProps extends React.HTMLAttributes<HTMLDivElement> {
88
claimsFor: number
99
claimsAgainst: number
10-
claimsForValue: number
11-
claimsAgainstValue: number
10+
claimsForValue?: number
11+
claimsAgainstValue?: number
1212
tvl: number
1313
currency?: CurrencyType
1414
}
@@ -17,8 +17,8 @@ const ClaimRow = ({
1717
claimsFor = 0,
1818
claimsAgainst = 0,
1919
tvl,
20-
claimsForValue,
21-
claimsAgainstValue,
20+
claimsForValue = 0,
21+
claimsAgainstValue = 0,
2222
currency,
2323
children,
2424
className,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './ProfileCard'
2+
export * from './components'

packages/1ui/src/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import './styles/globals.css'
2+
3+
export * from './styles'
4+
export * from './components'
5+
export * from './utils'
6+
export * from './types'

packages/1ui/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"jsx": "react-jsx",
55
"baseUrl": "./src",
6-
"outDir": "../../dist/packages/1ui"
6+
"outDir": "../../dist/packages/1ui",
7+
"composite": true
78
},
89
"include": ["src"]
910
}

0 commit comments

Comments
 (0)