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

[FEAT] 관리자 페이지 API 개발 #111

Merged
merged 13 commits into from
Nov 14, 2024
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
},
"editor.formatOnSave": true,
"eslint.enable": true,
"prettier.requireConfig": true
"prettier.requireConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
416 changes: 223 additions & 193 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@mantine/carousel": "^7.12.2",
"@mantine/core": "^7.11.2",
"@mantine/dates": "^7.12.2",
"@mantine/form": "^7.12.1",
"@mantine/hooks": "^7.11.2",
"@mantine/styles": "^6.0.22",
Expand All @@ -30,7 +31,7 @@
"embla-carousel-react": "^7.1.0",
"js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"next": "14.2.4",
"next": "^14.2.12",
"react": "^18",
"react-dom": "^18",
"swr": "^2.2.5"
Expand Down
71 changes: 3 additions & 68 deletions src/app/(admin)/admin/(contents)/(gallery)/gallery-create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,76 +1,11 @@
import { PrimaryButton } from "@/components/common/Buttons";
"use client";
import { PageHeader } from "@/components/common/PageHeader";
import { TextInput } from "@/components/common/TextInput";
import { GalleryEditFrom } from "@/components/pages/GalleryForm";
export default function AdminGalleryCreate() {
return (
<>
<PageHeader title="갤러리 사진 등록" />

<div
// style={{
// width: "100%",
// height: "auto",
// position: "relative",
// background: "gray",
// borderRadius: 12,
// }}
>
<div style={{ paddingLeft: 30 }}>
<table>
<tbody>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>제목</h3>
</td>
<td>
<TextInput></TextInput>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>연도</h3>
</td>
<td>
<TextInput></TextInput>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 추가</h3>
</td>
</tr>

<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 1</h3>
</td>
<td>
<input type="file"></input>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 2</h3>
</td>
<td>
<input type="file"></input>
</td>
</tr>
<tr>
<td style={{ paddingBlock: 20 }}></td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h4>1번 사진이 썸네일로 지정됩니다.</h4>
</td>
<td>
<PrimaryButton>갤러리 등록하기</PrimaryButton>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<GalleryEditFrom></GalleryEditFrom>
</>
);
}
89 changes: 4 additions & 85 deletions src/app/(admin)/admin/(contents)/(gallery)/gallery/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,94 +1,13 @@
import { DangerButton, PrimaryButton } from "@/components/common/Buttons";
"use client";
import { PageHeader } from "@/components/common/PageHeader";
import { TextInput } from "@/components/common/TextInput";
import Image from "next/image";
import { GalleryEditFrom } from "@/components/pages/GalleryForm";

const testimgurl = "https://i.ytimg.com/vi/h7SkjDKF11g/maxresdefault.jpg";

export default function AdminGalleryEdit() {
export default function AdminGalleryEdit({ params }: { params: { id: string } }) {
return (
<>
<PageHeader title="갤러리 사진 수정" />

<div
// style={{
// width: "100%",
// height: "auto",
// position: "relative",
// background: "gray",
// borderRadius: 12,
// }}
>
<div style={{ paddingLeft: 30 }}>
<Image
src={testimgurl}
alt="gallery preview image"
width={0}
height={0}
sizes="30vw"
style={{ width: "auto", height: "100%" }}
/>
<table>
<tbody>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>제목</h3>
</td>
<td>
<TextInput></TextInput>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>연도</h3>
</td>
<td>
<TextInput></TextInput>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 추가</h3>
</td>
</tr>

<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 1</h3>
</td>
<td>
<input type="file"></input>
</td>
<td>
<DangerButton>삭제</DangerButton>
</td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h3>사진 2</h3>
</td>
<td>
<input type="file"></input>
</td>
<td>
<DangerButton>삭제</DangerButton>
</td>
</tr>
<tr>
<td style={{ paddingBlock: 20 }}></td>
</tr>
<tr>
<td style={{ paddingRight: 10 }}>
<h4>1번 사진이 썸네일로 지정됩니다.</h4>
</td>
<td>
<PrimaryButton>갤러리 수정하기</PrimaryButton>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<GalleryEditFrom galleryID={parseInt(params.id)}></GalleryEditFrom>
</>
);
}
96 changes: 2 additions & 94 deletions src/app/(admin)/admin/(contents)/(gallery)/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,105 +1,13 @@
"use client";

import classes from "../galley.module.css";
import { SearchInput } from "@/components/common/SearchInput";
import { GalleryPreview } from "@/components/common/GalleryPreview/GalleryPreview";
import { useEffect, useState } from "react";
import { PageHeader } from "@/components/common/PageHeader";
import { Dropdown } from "@/components/common/Dropdown/Dropdown";
import { PrimaryButton } from "@/components/common/Buttons";
import { GalleryListSection } from "@/components/pages/GalleryListSection";

const testimgurl = "https://i.ytimg.com/vi/h7SkjDKF11g/maxresdefault.jpg";
export interface Props {
imgUrl: string;
title: string;
date: Date;
viewCount?: number;
}
function useWindowSize() {
const [windowSize, setWindowSize] = useState({
width: 0,
height: 0,
});

useEffect(() => {
if (window) {
const handleResize = () => {
setWindowSize({
width: window.innerWidth,
height: window.innerHeight,
});
};

window.addEventListener("resize", handleResize);

handleResize();
return () => window.removeEventListener("resize", handleResize);
}
}, []);
return windowSize;
}
const minWidth = 280;
export default function AdminGalleryPage() {
const reshape: Props[][] = [];
const windowWidth = useWindowSize().width;
const col = Math.max(Math.floor((windowWidth - 400) / minWidth), 1);
const width = Math.max((windowWidth - 400 - 20 * (col - 1)) / col, minWidth);
const datas: Props[] = Array(10).fill({
imgUrl: testimgurl,
title: "짱짱 멋진 제목",
date: new Date(),
viewCount: col,
});
while (datas.length) reshape.push(datas.splice(0, col));
return (
<>
<PageHeader title="갤러리 관리" />

<table className={classes.search}>
<tbody>
<tr>
<td>
<Dropdown
options={["1", "2"]}
placeholder={"연도 선택"}
onOptionClick={function (): void {
throw new Error("Function not implemented.");
}}
></Dropdown>
</td>
<td>
<SearchInput w={300}></SearchInput>
</td>
<td>
<PrimaryButton>검색</PrimaryButton>
</td>
</tr>
</tbody>
</table>
<div style={{ display: "flex", padding: 10 }}>
<PrimaryButton style={{ marginLeft: "auto" }}>사진 등록</PrimaryButton>
</div>
<table className={classes.cards}>
<tbody>
{reshape.map((e) => {
return (
<>
<tr>
{e.map((f) => {
return (
<>
<td>
<GalleryPreview {...f} width={width} height={(width / 300) * 180} />
</td>
</>
);
})}
</tr>
</>
);
})}
</tbody>
</table>
<GalleryListSection></GalleryListSection>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PageHeader } from "@/components/common/PageHeader";
import { InterviewEditFrom } from "@/components/pages/InterviewForm";
export default function AdminTalkCreate() {
return (
<>
<PageHeader title="대담 영상 등록" />
<InterviewEditFrom></InterviewEditFrom>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.search {
width: 350px;
margin-left: auto;
padding: 10px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { PageHeader } from "@/components/common/PageHeader";
import { InterviewEditFrom } from "@/components/pages/InterviewForm";

export default function AdminTalkEdit({ params }: { params: { id: string } }) {
return (
<>
<PageHeader title="대담 영상 수정" />
<InterviewEditFrom interviewID={parseInt(params.id)}></InterviewEditFrom>
</>
);
}
13 changes: 13 additions & 0 deletions src/app/(admin)/admin/(contents)/(interviews)/interviews/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use client";

import { PageHeader } from "@/components/common/PageHeader";
import { InterviewListSection } from "@/components/pages/InterviewListSection";

export default function AdminTalkPage() {
return (
<>
<PageHeader title="대담 영상 관리" />
<InterviewListSection></InterviewListSection>
</>
);
}
Loading
Loading