Skip to content

Commit

Permalink
Merge pull request #94 from game-node-app/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Lamarcke authored Jun 19, 2024
2 parents 758aad9 + 949a72e commit e6499f6
Show file tree
Hide file tree
Showing 53 changed files with 1,478 additions and 87 deletions.
9 changes: 9 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
const nextConfig = {
output: "standalone",
reactStrictMode: true,
async redirects() {
return [
{
source: "/admin",
destination: "/admin/moderation",
permanent: true,
},
];
},
};

module.exports = nextConfig;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"@mantine/next": "^6.0.21",
"@mantine/notifications": "^7.7.1",
"@mantine/nprogress": "^7.7.1",
"@mantine/tiptap": "^7.7.1",
"@socialgouv/matomo-next": "^1.8.1",
"@tabler/icons-react": "^3.1.0",
"@tanstack/react-query": "^5.29.0",
"@mantine/tiptap": "^7.7.1",
"@tiptap/extension-link": "^2.2.6",
"@tiptap/pm": "^2.2.6",
"@tiptap/react": "^2.2.6",
Expand All @@ -36,7 +36,6 @@
"next": "^14.1.4",
"nextjs-cors": "^2.1.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-easy-crop": "^5.0.6",
Expand All @@ -56,6 +55,7 @@
"@types/node": "20.12.5",
"@types/react": "^18.2.74",
"@types/react-dom": "^18.2.24",
"prettier": "^3.0.0",
"eslint": "^8.52.0",
"eslint-config-next": "^14.1.4",
"eslint-config-prettier": "^9.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/components/activity/item/ReviewActivityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ const ReviewActivityItem = ({ activity }: Props) => {
</Box>
<Box className={"w-3/12"}>
<Stack gap={5}>
<Link href={`/game/${gameQuery.data?.id}`}>
<Link
href={`/game/${gameQuery.data?.id}?reviewId=${activity.reviewId}`}
>
<Title className={"text-sm lg:text-md"}>
{gameQuery.data?.name}
</Title>
Expand All @@ -93,10 +95,12 @@ const ReviewActivityItem = ({ activity }: Props) => {
<ActivityCreateDate
createdAtDate={activity.createdAt}
/>

<GameRating
value={reviewQuery.data?.rating}
size={"md"}
/>

<Group>
<ActivityItemLikes activity={activity} />
</Group>
Expand Down
24 changes: 24 additions & 0 deletions src/components/admin/AdminLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { PropsWithChildren } from "react";
import ModerationSidebar from "@/components/admin/moderation/ModerationSidebar";
import { Box, Group, Stack } from "@mantine/core";
import SessionAuthWithRoles from "@/components/auth/SessionAuthWithRoles";
import { EUserRoles } from "@/components/auth/roles";
import AdminLayoutTabs from "@/components/admin/AdminLayoutTabs";

const AdminLayout = ({ children }: PropsWithChildren) => {
return (
<SessionAuthWithRoles roles={[EUserRoles.MOD, EUserRoles.ADMIN]}>
<Stack className={"w-full h-full flex-wrap justify-start gap-1"}>
<AdminLayoutTabs />
<Group className={"w-full h-full items-start flex-nowrap"}>
<Box className={"w-full lg:w-3/12"}>
<ModerationSidebar />
</Box>
<Box className={"w-full lg:w-9/12 mt-4"}>{children}</Box>
</Group>
</Stack>
</SessionAuthWithRoles>
);
};

export default AdminLayout;
53 changes: 53 additions & 0 deletions src/components/admin/AdminLayoutTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Paper, PaperProps, Tabs } from "@mantine/core";
import { useRouter } from "next/router";
import React from "react";

interface Props extends PaperProps {}

const AdminLayoutTabs = ({ ...others }: Props) => {
const router = useRouter();
const pathName = router.pathname;

return (
<Paper
styles={{
root: {
backgroundColor: "#161616",
},
}}
className="w-full h-full lg:px-12 py-6"
{...others}
>
<Tabs
onChange={(v) => {
if (v) {
router.push(`/admin/${v}`);
}
}}
classNames={{
tab: "border-0 data-[active=true]:text-[#DCDCDC] text-[#828282] text-lg",
list: "border-0 before:!content-none",
}}
>
<Tabs.List>
<Tabs.Tab
data-active={pathName.includes("moderation")}
size={"xl"}
value={"moderation"}
>
Moderation
</Tabs.Tab>
<Tabs.Tab
data-active={pathName.includes("achievements")}
size={"xl"}
value={"achievements"}
>
Achievements
</Tabs.Tab>
</Tabs.List>
</Tabs>
</Paper>
);
};

export default AdminLayoutTabs;
29 changes: 29 additions & 0 deletions src/components/admin/moderation/ModerationSidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { Paper, Stack, Text } from "@mantine/core";
import ModerationReportList from "@/components/admin/moderation/list/ModerationReportList";

interface Props {
onReportSelected: (reportId: number) => void;
}

const ModerationSidebar = () => {
return (
<Stack className={"w-full gap-0"}>
<Paper
className={
"w-full flex justify-center items-center border-0 rounded-[0] h-[64px]"
}
styles={{
root: {
backgroundColor: "#202020",
},
}}
>
<Text className={"text-center"}>Reports</Text>
</Paper>
<ModerationReportList />
</Stack>
);
};

export default ModerationSidebar;
Loading

0 comments on commit e6499f6

Please sign in to comment.