-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move some Settings components to @/settings
- Loading branch information
1 parent
18254f2
commit 78ef812
Showing
12 changed files
with
162 additions
and
167 deletions.
There are no files selected for viewing
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysTable.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,53 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import styled from '@emotion/styled'; | ||
|
||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; | ||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; | ||
import { SettingsApiKeysFieldItemTableRow } from '@/settings/developers/components/SettingsApiKeysFieldItemTableRow'; | ||
import { ApiFieldItem } from '@/settings/developers/types/api-key/ApiFieldItem'; | ||
import { ApiKey } from '@/settings/developers/types/api-key/ApiKey'; | ||
import { formatExpirations } from '@/settings/developers/utils/format-expiration'; | ||
import { Table } from '@/spreadsheet-import/components/Table'; | ||
import { TableBody } from '@/ui/layout/table/components/TableBody'; | ||
import { TableHeader } from '@/ui/layout/table/components/TableHeader'; | ||
import { TableRow } from '@/ui/layout/table/components/TableRow'; | ||
|
||
const StyledTableBody = styled(TableBody)` | ||
border-bottom: 1px solid ${({ theme }) => theme.border.color.light}; | ||
`; | ||
|
||
const StyledTableRow = styled(TableRow)` | ||
grid-template-columns: 312px 132px 68px; | ||
`; | ||
|
||
export const SettingsApiKeysTable = () => { | ||
const navigate = useNavigate(); | ||
|
||
const { records: apiKeys } = useFindManyRecords<ApiKey>({ | ||
objectNameSingular: CoreObjectNameSingular.ApiKey, | ||
filter: { revokedAt: { is: 'NULL' } }, | ||
}); | ||
|
||
return ( | ||
<Table> | ||
<StyledTableRow> | ||
<TableHeader>Name</TableHeader> | ||
<TableHeader>Expiration</TableHeader> | ||
<TableHeader></TableHeader> | ||
</StyledTableRow> | ||
{!!apiKeys.length && ( | ||
<StyledTableBody> | ||
{formatExpirations(apiKeys).map((fieldItem) => ( | ||
<SettingsApiKeysFieldItemTableRow | ||
key={fieldItem.id} | ||
fieldItem={fieldItem as ApiFieldItem} | ||
onClick={() => { | ||
navigate(`/settings/developers/api-keys/${fieldItem.id}`); | ||
}} | ||
/> | ||
))} | ||
</StyledTableBody> | ||
)} | ||
</Table> | ||
); | ||
}; |
2 changes: 1 addition & 1 deletion
2
...rs/components/ReadDocumentationButton.tsx → ...nents/SettingsReadDocumentationButton.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
51 changes: 51 additions & 0 deletions
51
packages/twenty-front/src/modules/settings/developers/components/SettingsWebhooksTable.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,51 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import styled from '@emotion/styled'; | ||
|
||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; | ||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; | ||
import { SettingsDevelopersWebhookTableRow } from '@/settings/developers/components/SettingsDevelopersWebhookTableRow'; | ||
import { WebhookFieldItem } from '@/settings/developers/types/webhook/WebhookFieldItem'; | ||
import { Table } from '@/ui/layout/table/components/Table'; | ||
import { TableBody } from '@/ui/layout/table/components/TableBody'; | ||
import { TableHeader } from '@/ui/layout/table/components/TableHeader'; | ||
import { TableRow } from '@/ui/layout/table/components/TableRow'; | ||
|
||
const StyledTableBody = styled(TableBody)` | ||
border-bottom: 1px solid ${({ theme }) => theme.border.color.light}; | ||
`; | ||
|
||
const StyledTableRow = styled(TableRow)` | ||
grid-template-columns: 444px 68px; | ||
`; | ||
|
||
export const SettingsWebhooksTable = () => { | ||
const navigate = useNavigate(); | ||
|
||
const { records: webhooks } = useFindManyRecords<WebhookFieldItem>({ | ||
objectNameSingular: CoreObjectNameSingular.Webhook, | ||
}); | ||
|
||
return ( | ||
<Table> | ||
<StyledTableRow> | ||
<TableHeader>Url</TableHeader> | ||
<TableHeader></TableHeader> | ||
</StyledTableRow> | ||
{!!webhooks.length && ( | ||
<StyledTableBody> | ||
{webhooks.map((webhookFieldItem) => ( | ||
<SettingsDevelopersWebhookTableRow | ||
key={webhookFieldItem.id} | ||
fieldItem={webhookFieldItem} | ||
onClick={() => { | ||
navigate( | ||
`/settings/developers/webhooks/${webhookFieldItem.id}`, | ||
); | ||
}} | ||
/> | ||
))} | ||
</StyledTableBody> | ||
)} | ||
</Table> | ||
); | ||
}; |
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
61 changes: 54 additions & 7 deletions
61
packages/twenty-front/src/pages/settings/developers/SettingsDevelopers.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
File renamed without changes.
File renamed without changes.
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
80 changes: 0 additions & 80 deletions
80
packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeys.tsx
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
packages/twenty-front/src/pages/settings/developers/webhooks/SettingsDevelopersWebhooks.tsx
This file was deleted.
Oops, something went wrong.