Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Developers page is not optimised for mobile viewport #7493

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconChevronRight } from 'twenty-ui';
import { IconChevronRight, MOBILE_VIEWPORT } from 'twenty-ui';

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

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

const StyledNameTableCell = styled(TableCell)`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
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';
Expand All @@ -10,15 +8,25 @@ 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';
import styled from '@emotion/styled';
import { MOBILE_VIEWPORT } from 'twenty-ui';

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

const StyledTableRow = styled(TableRow)`
grid-template-columns: 312px auto 28px;
@media (max-width: ${MOBILE_VIEWPORT}px) {
width: 95%;
grid-template-columns: 20fr 2fr;
}
`;

export const SettingsApiKeysTable = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import styled from '@emotion/styled';
import { H2Title, IconPlus } from 'twenty-ui';
import { H2Title, IconPlus, MOBILE_VIEWPORT } from 'twenty-ui';

import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsApiKeysTable } from '@/settings/developers/components/SettingsApiKeysTable';
Expand All @@ -15,9 +16,20 @@ const StyledButtonContainer = styled.div`
display: flex;
justify-content: flex-end;
padding-top: ${({ theme }) => theme.spacing(2)};
@media (max-width: ${MOBILE_VIEWPORT}px) {
padding-top: ${({ theme }) => theme.spacing(5)};
}
`;

const StyledContainer = styled.div<{ isMobile: boolean }>`
display: flex;
Comment on lines +21 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: StyledContainer doesn't use isMobile prop. Consider using it for mobile-specific styling

flex-direction: column;
overflow: hidden;
gap: ${({ theme }) => theme.spacing(2)};
`;

export const SettingsDevelopers = () => {
const isMobile = useIsMobile();
return (
<SubMenuTopBarContainer
title="Developers"
Expand All @@ -31,38 +43,40 @@ export const SettingsDevelopers = () => {
]}
>
<SettingsPageContainer>
<Section>
<H2Title
title="API keys"
description="Active APIs keys created by you or your team."
/>
<SettingsApiKeysTable />
<StyledButtonContainer>
<Button
Icon={IconPlus}
title="Create API key"
size="small"
variant="secondary"
to={'/settings/developers/api-keys/new'}
<StyledContainer isMobile={isMobile}>
<Section>
<H2Title
title="API keys"
description="Active APIs keys created by you or your team."
/>
</StyledButtonContainer>
</Section>
<Section>
<H2Title
title="Webhooks"
description="Establish Webhook endpoints for notifications on asynchronous events."
/>
<SettingsWebhooksTable />
<StyledButtonContainer>
<Button
Icon={IconPlus}
title="Create Webhook"
size="small"
variant="secondary"
to={'/settings/developers/webhooks/new'}
<SettingsApiKeysTable />
<StyledButtonContainer>
<Button
Icon={IconPlus}
title="Create API key"
size="small"
variant="secondary"
to={'/settings/developers/api-keys/new'}
/>
</StyledButtonContainer>
</Section>
<Section>
<H2Title
title="Webhooks"
description="Establish Webhook endpoints for notifications on asynchronous events."
/>
</StyledButtonContainer>
</Section>
<SettingsWebhooksTable />
<StyledButtonContainer>
<Button
Icon={IconPlus}
title="Create Webhook"
size="small"
variant="secondary"
to={'/settings/developers/webhooks/new'}
/>
</StyledButtonContainer>
</Section>
</StyledContainer>
</SettingsPageContainer>
</SubMenuTopBarContainer>
);
Expand Down
Loading