Skip to content

Commit 656ab4e

Browse files
fix: Developers page is not optimised for mobile viewport (#7493)
## Description - This PR solves the issue #7483 - optimised the developers page for all mobile viewports --------- Co-authored-by: Charles Bochet <[email protected]>
1 parent c57d8f1 commit 656ab4e

File tree

3 files changed

+62
-36
lines changed

3 files changed

+62
-36
lines changed

packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysFieldItemTableRow.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useTheme } from '@emotion/react';
22
import styled from '@emotion/styled';
3-
import { IconChevronRight } from 'twenty-ui';
3+
import { IconChevronRight, MOBILE_VIEWPORT } from 'twenty-ui';
44

55
import { ApiFieldItem } from '@/settings/developers/types/api-key/ApiFieldItem';
66
import { TableCell } from '@/ui/layout/table/components/TableCell';
77
import { TableRow } from '@/ui/layout/table/components/TableRow';
88

99
export const StyledApisFieldTableRow = styled(TableRow)`
1010
grid-template-columns: 312px auto 28px;
11+
@media (max-width: ${MOBILE_VIEWPORT}px) {
12+
width: 100%;
13+
grid-template-columns: 12fr 4fr;
14+
}
1115
`;
1216

1317
const StyledNameTableCell = styled(TableCell)`

packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysTable.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import styled from '@emotion/styled';
2-
31
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
42
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
53
import { SettingsApiKeysFieldItemTableRow } from '@/settings/developers/components/SettingsApiKeysFieldItemTableRow';
@@ -10,15 +8,25 @@ import { Table } from '@/ui/layout/table/components/Table';
108
import { TableBody } from '@/ui/layout/table/components/TableBody';
119
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
1210
import { TableRow } from '@/ui/layout/table/components/TableRow';
11+
import styled from '@emotion/styled';
12+
import { MOBILE_VIEWPORT } from 'twenty-ui';
1313

1414
const StyledTableBody = styled(TableBody)`
1515
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
16-
max-height: 260px;
17-
overflow-y: auto;
16+
@media (max-width: ${MOBILE_VIEWPORT}px) {
17+
padding-top: ${({ theme }) => theme.spacing(3)};
18+
display: flex;
19+
justify-content: space-between;
20+
scroll-behavior: smooth;
21+
}
1822
`;
1923

2024
const StyledTableRow = styled(TableRow)`
2125
grid-template-columns: 312px auto 28px;
26+
@media (max-width: ${MOBILE_VIEWPORT}px) {
27+
width: 95%;
28+
grid-template-columns: 20fr 2fr;
29+
}
2230
`;
2331

2432
export const SettingsApiKeysTable = () => {

packages/twenty-front/src/pages/settings/developers/SettingsDevelopers.tsx

+45-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
12
import styled from '@emotion/styled';
2-
import { H2Title, IconPlus } from 'twenty-ui';
3+
import { H2Title, IconPlus, MOBILE_VIEWPORT } from 'twenty-ui';
34

45
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
56
import { SettingsApiKeysTable } from '@/settings/developers/components/SettingsApiKeysTable';
@@ -15,9 +16,20 @@ const StyledButtonContainer = styled.div`
1516
display: flex;
1617
justify-content: flex-end;
1718
padding-top: ${({ theme }) => theme.spacing(2)};
19+
@media (max-width: ${MOBILE_VIEWPORT}px) {
20+
padding-top: ${({ theme }) => theme.spacing(5)};
21+
}
22+
`;
23+
24+
const StyledContainer = styled.div<{ isMobile: boolean }>`
25+
display: flex;
26+
flex-direction: column;
27+
overflow: hidden;
28+
gap: ${({ theme }) => theme.spacing(2)};
1829
`;
1930

2031
export const SettingsDevelopers = () => {
32+
const isMobile = useIsMobile();
2133
return (
2234
<SubMenuTopBarContainer
2335
title="Developers"
@@ -31,38 +43,40 @@ export const SettingsDevelopers = () => {
3143
]}
3244
>
3345
<SettingsPageContainer>
34-
<Section>
35-
<H2Title
36-
title="API keys"
37-
description="Active APIs keys created by you or your team."
38-
/>
39-
<SettingsApiKeysTable />
40-
<StyledButtonContainer>
41-
<Button
42-
Icon={IconPlus}
43-
title="Create API key"
44-
size="small"
45-
variant="secondary"
46-
to={'/settings/developers/api-keys/new'}
46+
<StyledContainer isMobile={isMobile}>
47+
<Section>
48+
<H2Title
49+
title="API keys"
50+
description="Active APIs keys created by you or your team."
4751
/>
48-
</StyledButtonContainer>
49-
</Section>
50-
<Section>
51-
<H2Title
52-
title="Webhooks"
53-
description="Establish Webhook endpoints for notifications on asynchronous events."
54-
/>
55-
<SettingsWebhooksTable />
56-
<StyledButtonContainer>
57-
<Button
58-
Icon={IconPlus}
59-
title="Create Webhook"
60-
size="small"
61-
variant="secondary"
62-
to={'/settings/developers/webhooks/new'}
52+
<SettingsApiKeysTable />
53+
<StyledButtonContainer>
54+
<Button
55+
Icon={IconPlus}
56+
title="Create API key"
57+
size="small"
58+
variant="secondary"
59+
to={'/settings/developers/api-keys/new'}
60+
/>
61+
</StyledButtonContainer>
62+
</Section>
63+
<Section>
64+
<H2Title
65+
title="Webhooks"
66+
description="Establish Webhook endpoints for notifications on asynchronous events."
6367
/>
64-
</StyledButtonContainer>
65-
</Section>
68+
<SettingsWebhooksTable />
69+
<StyledButtonContainer>
70+
<Button
71+
Icon={IconPlus}
72+
title="Create Webhook"
73+
size="small"
74+
variant="secondary"
75+
to={'/settings/developers/webhooks/new'}
76+
/>
77+
</StyledButtonContainer>
78+
</Section>
79+
</StyledContainer>
6680
</SettingsPageContainer>
6781
</SubMenuTopBarContainer>
6882
);

0 commit comments

Comments
 (0)