generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stub out each decl panel (#3441)
Just stubbing out these pages so we have somewhere to add content once we figure out what we need. ![Screenshot 2024-11-20 at 9 16 24 AM](https://github.com/user-attachments/assets/12364c14-4505-4f6e-b90b-38e070ad2419) ![Screenshot 2024-11-20 at 9 16 26 AM](https://github.com/user-attachments/assets/3a76ef55-24b8-44cc-9167-1a686375e631) ![Screenshot 2024-11-20 at 9 16 28 AM](https://github.com/user-attachments/assets/98f1fd10-6f1b-483e-9b0b-54e2d6b5ce2d) ![Screenshot 2024-11-20 at 9 16 33 AM](https://github.com/user-attachments/assets/3e17097d-9280-4874-8585-3aae4b51c6fc) ![Screenshot 2024-11-20 at 9 16 35 AM](https://github.com/user-attachments/assets/1e532398-dc09-495b-ad74-9d40fb302da9)
- Loading branch information
1 parent
2a5d45a
commit 9781ce1
Showing
12 changed files
with
148 additions
and
32 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
frontend/console/src/features/modules/decls/RightPanelHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 26 additions & 7 deletions
33
frontend/console/src/features/modules/decls/database/DatabasePanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
import { ResizablePanels } from '../../../../components/ResizablePanels' | ||
import type { Database } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' | ||
import { declIcon } from '../../module.utils' | ||
import { Schema } from '../../schema/Schema' | ||
import { DeclDefaultPanels } from '../DeclDefaultPanels' | ||
import { PanelHeader } from '../PanelHeader' | ||
import { References } from '../References' | ||
import { RightPanelHeader } from '../RightPanelHeader' | ||
import { databasePanels } from './DatabaseRightPanels' | ||
|
||
export const DatabasePanel = ({ value, schema, moduleName, declName }: { value: Database; schema: string; moduleName: string; declName: string }) => { | ||
const decl = value.database | ||
if (!decl) { | ||
return | ||
} | ||
|
||
return ( | ||
<div className='py-2 px-4'> | ||
<PanelHeader title='Database' declRef={`${moduleName}.${declName}`} exported={false} comments={value.database?.comments} /> | ||
<div className='-mx-3.5'> | ||
<Schema schema={schema} /> | ||
</div> | ||
<References references={value.references} /> | ||
<div className='h-full'> | ||
<ResizablePanels | ||
mainContent={ | ||
<div className='p-4'> | ||
<div className=''> | ||
<PanelHeader title='Database' declRef={`${moduleName}.${declName}`} exported={false} comments={decl.comments} /> | ||
<div className='-mx-3.5'> | ||
<Schema schema={schema} /> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
rightPanelHeader={<RightPanelHeader Icon={declIcon('database', decl)} title={declName} />} | ||
rightPanelPanels={[...databasePanels(value), ...DeclDefaultPanels(schema, value.references)]} | ||
storageKeyPrefix='databasePanel' | ||
/> | ||
</div> | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
frontend/console/src/features/modules/decls/database/DatabaseRightPanels.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' | ||
import type { Database } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' | ||
import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' | ||
|
||
export const databasePanels = (database: Database) => { | ||
return [ | ||
{ | ||
title: 'Details', | ||
expanded: true, | ||
children: [ | ||
<RightPanelAttribute key='name' name='Name' value={database.database?.name} />, | ||
<RightPanelAttribute key='type' name='Type' value={database.database?.type} />, | ||
], | ||
}, | ||
] as ExpandablePanelProps[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
frontend/console/src/features/modules/decls/enum/EnumRightPanels.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' | ||
import type { Enum } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' | ||
import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' | ||
|
||
export const enumPanels = (enumDecl: Enum) => { | ||
return [ | ||
{ | ||
title: 'Details', | ||
expanded: true, | ||
children: [ | ||
<RightPanelAttribute key='name' name='Name' value={enumDecl.enum?.name} />, | ||
<RightPanelAttribute key='type' name='Type' value={enumDecl.enum?.type?.value.case} />, | ||
], | ||
}, | ||
] as ExpandablePanelProps[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 27 additions & 7 deletions
34
frontend/console/src/features/modules/decls/typealias/TypeAliasPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
import { ResizablePanels } from '../../../../components/ResizablePanels' | ||
import type { TypeAlias } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' | ||
import { declIcon } from '../../module.utils' | ||
import { Schema } from '../../schema/Schema' | ||
import { DeclDefaultPanels } from '../DeclDefaultPanels' | ||
import { PanelHeader } from '../PanelHeader' | ||
import { References } from '../References' | ||
import { RightPanelHeader } from '../RightPanelHeader' | ||
import { typeAliasPanels } from './TypeAliasRightPanels' | ||
|
||
export const TypeAliasPanel = ({ value, schema, moduleName, declName }: { value: TypeAlias; schema: string; moduleName: string; declName: string }) => { | ||
if (!value || !schema) { | ||
return | ||
} | ||
|
||
const decl = value.typealias | ||
if (!decl) { | ||
return | ||
} | ||
|
||
return ( | ||
<div className='py-2 px-4'> | ||
<PanelHeader title='Type Alias' declRef={`${moduleName}.${declName}`} exported={!!value.typealias?.export} comments={value.typealias?.comments} /> | ||
<div className='-mx-3.5'> | ||
<Schema schema={schema} /> | ||
</div> | ||
<References references={value.references} /> | ||
<div className='h-full'> | ||
<ResizablePanels | ||
mainContent={ | ||
<div className='p-4'> | ||
<div className=''> | ||
<PanelHeader title='TypeAlias' declRef={`${moduleName}.${declName}`} exported={decl.export} comments={decl.comments} /> | ||
<div className='-mx-3.5'> | ||
<Schema schema={schema} /> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
rightPanelHeader={<RightPanelHeader Icon={declIcon('typealias', decl)} title={declName} />} | ||
rightPanelPanels={[...typeAliasPanels(value), ...DeclDefaultPanels(schema, value.references)]} | ||
storageKeyPrefix='typeAliasPanel' | ||
/> | ||
</div> | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
frontend/console/src/features/modules/decls/typealias/TypeAliasRightPanels.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' | ||
import type { TypeAlias } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' | ||
import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' | ||
|
||
export const typeAliasPanels = (typeAlias: TypeAlias) => { | ||
return [ | ||
{ | ||
title: 'Details', | ||
expanded: true, | ||
children: [ | ||
<RightPanelAttribute key='name' name='Name' value={typeAlias.typealias?.name} />, | ||
<RightPanelAttribute key='export' name='Type' value={typeAlias.typealias?.type?.value.case} />, | ||
], | ||
}, | ||
] as ExpandablePanelProps[] | ||
} |