style: improve mobile compatibility of certain manage pages (#678)

* style: improve mobile compatibility of certain manage pages

* style: improve mobile support for more manage pages

* fix: format issues

* chore: address pull request feedback
This commit is contained in:
Meier Lukas authored and GitHub committed 2024-06-22 21:02:17 +02:00
1 parent f92aeba403
commit 6029a5b592
19 files changed
+167 -95

No files matched your search

@@ -1,7 +1,7 @@
import type { PropsWithChildren } from "react";
import Link from "next/link";
import { notFound } from "next/navigation";
import { Button, Container, Grid, GridCol, Group, Stack, Text, Title } from "@mantine/core";
import { Button, Grid, GridCol, Group, Stack, Text, Title } from "@mantine/core";
import { IconSettings, IconShieldLock } from "@tabler/icons-react";
import { api } from "@homarr/api/server";
@@ -9,6 +9,7 @@ import { auth } from "@homarr/auth/next";
import { getI18n, getScopedI18n } from "@homarr/translation/server";
import { UserAvatar } from "@homarr/ui";
import { ManageContainer } from "~/components/manage/manage-container";
import { catchTrpcNotFound } from "~/errors/trpc-not-found";
import { NavigationLink } from "../groups/[id]/_navigation";
import { canAccessUserEditPage } from "./access";
@@ -28,7 +29,7 @@ export default async function Layout({ children, params }: PropsWithChildren<Lay
}
return (
<Container size="xl">
<ManageContainer size="xl">
<Grid>
<GridCol span={12}>
<Group justify="space-between" align="center">
@@ -64,6 +65,6 @@ export default async function Layout({ children, params }: PropsWithChildren<Lay
</GridCol>
<GridCol span={{ xs: 12, md: 8, lg: 9, xl: 10 }}>{children}</GridCol>
</Grid>
</Container>
</ManageContainer>
);
}
@@ -1,11 +1,12 @@
import type { PropsWithChildren } from "react";
import Link from "next/link";
import { Button, Container, Grid, GridCol, Group, Stack, Text, Title } from "@mantine/core";
import { Button, Grid, GridCol, Group, Stack, Text, Title } from "@mantine/core";
import { IconLock, IconSettings, IconUsersGroup } from "@tabler/icons-react";
import { api } from "@homarr/api/server";
import { getI18n, getScopedI18n } from "@homarr/translation/server";
import { ManageContainer } from "~/components/manage/manage-container";
import { NavigationLink } from "./_navigation";
interface LayoutProps {
@@ -18,7 +19,7 @@ export default async function Layout({ children, params }: PropsWithChildren<Lay
const group = await api.group.getById({ id: params.id });
return (
<Container size="xl">
<ManageContainer size="xl">
<Grid>
<GridCol span={12}>
<Group justify="space-between" align="center">
@@ -54,6 +55,6 @@ export default async function Layout({ children, params }: PropsWithChildren<Lay
</GridCol>
<GridCol span={{ xs: 12, md: 8, lg: 9, xl: 10 }}>{children}</GridCol>
</Grid>
</Container>
</ManageContainer>
);
}
@@ -1,7 +1,6 @@
"use client";
import { useCallback } from "react";
import { Button } from "@mantine/core";
import { clientApi } from "@homarr/api/client";
import { useModalAction } from "@homarr/modals";
@@ -9,6 +8,7 @@ import { useScopedI18n } from "@homarr/translation/client";
import { UserSelectModal } from "~/app/[locale]/boards/[name]/settings/_access/user-select-modal";
import { revalidatePathActionAsync } from "~/app/revalidatePathAction";
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
interface AddGroupMemberProps {
groupId: string;
@@ -40,8 +40,8 @@ export const AddGroupMember = ({ groupId, presentUserIds }: AddGroupMemberProps)
}, [openModal, presentUserIds, groupId, mutateAsync, tMembersAdd]);
return (
<Button color="teal" onClick={handleAddMember}>
<MobileAffixButton color="teal" onClick={handleAddMember}>
{tMembersAdd("label")}
</Button>
</MobileAffixButton>
);
};
@@ -101,7 +101,7 @@ interface PermissionRowProps {
const PermissionRow = ({ name, label, description }: PermissionRowProps) => {
return (
<Group justify="space-between" align="center">
<Group justify="space-between" align="center" wrap="nowrap">
<Stack gap={0}>
<Text fw={500}>{label}</Text>
<Text c="gray.5">{description}</Text>
@@ -11,6 +11,7 @@ import { useI18n } from "@homarr/translation/client";
import { validation } from "@homarr/validation";
import { revalidatePathActionAsync } from "~/app/revalidatePathAction";
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
export const AddGroup = () => {
const t = useI18n();
@@ -21,9 +22,9 @@ export const AddGroup = () => {
}, [openModal]);
return (
<Button onClick={handleAddGroup} color="teal">
<MobileAffixButton onClick={handleAddGroup} color="teal">
{t("group.action.create.label")}
</Button>
</MobileAffixButton>
);
};
@@ -1,17 +1,5 @@
import Link from "next/link";
import {
Anchor,
Container,
Group,
Stack,
Table,
TableTbody,
TableTd,
TableTh,
TableThead,
TableTr,
Title,
} from "@mantine/core";
import { Anchor, Group, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Title } from "@mantine/core";
import type { RouterOutputs } from "@homarr/api";
import { api } from "@homarr/api/server";
@@ -19,6 +7,7 @@ import { getI18n } from "@homarr/translation/server";
import { SearchInput, TablePagination, UserAvatarGroup } from "@homarr/ui";
import { z } from "@homarr/validation";
import { ManageContainer } from "~/components/manage/manage-container";
import { AddGroup } from "./_add-group";
const searchParamsSchema = z.object({
@@ -41,7 +30,7 @@ export default async function GroupsListPage(props: GroupsListPageProps) {
const { items: groups, totalCount } = await api.group.getPaginated(searchParams);
return (
<Container size="xl">
<ManageContainer size="xl">
<Stack>
<Title>{t("group.title")}</Title>
<Group justify="space-between">
@@ -72,7 +61,7 @@ export default async function GroupsListPage(props: GroupsListPageProps) {
<TablePagination total={Math.ceil(totalCount / searchParams.pageSize)} />
</Group>
</Stack>
</Container>
</ManageContainer>
);
}