Merge pull request 'iipbs_cs' (#1) from iipbs_cs into main

Reviewed-on: http://www.onasys.co.kr:3000/ONAANDALL/frontend/pulls/1
This commit was merged in pull request #1.
This commit is contained in:
2025-03-06 11:56:31 +09:00
32 changed files with 422 additions and 6015 deletions
+4 -1
View File
@@ -12,7 +12,10 @@
"@common/assets": "workspace:*",
"@common/components": "workspace:*",
"@tanstack/react-table": "^8.21.2",
"next": "15.1.7"
"chart.js": "^4.4.8",
"next": "15.1.7",
"react-chartjs-2": "^5.3.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
+1 -1
View File
@@ -38,7 +38,7 @@ const columns = [
header: "사이트명",
}),
columnHelper.accessor("대표_URL", {
header: "대표_URL",
header: "대표 URL",
}),
columnHelper.accessor("기본_사이트_여부", {
header: "기본 사이트 여부",
@@ -0,0 +1,164 @@
"use client";
import { useState } from "react";
import {
Dialog,
DialogTrigger,
Button,
DialogContent,
DialogHeader,
DialogTitle,
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
Input,
RadioGroup,
RadioGroupItem,
Checkbox,
} from "@common/components";
type IP = {
id: number;
ipAddress: string;
allowed: boolean;
};
function IPManagementDialog() {
const [rows, setRows] = useState<IP[]>([]);
const [rowSelection, setRowSelection] = useState<IP["id"][]>([]);
const handleSave = () => {};
const handleAddIP = () => {
const newIP: IP = {
id: Date.now(),
ipAddress: "",
allowed: true,
};
setRows([...rows, newIP]);
};
const handleDeleteIP = () => {
const filteredRows = rows.filter((row) => !rowSelection.includes(row.id));
setRows(filteredRows);
setRowSelection([]);
};
const handleIPAddressChange = (id: number, value: string) => {
setRows(
rows.map((row) => (row.id === id ? { ...row, ipAddress: value } : row)),
);
};
const handleAllowedChange = (id: number, value: boolean) => {
setRows(
rows.map((row) => (row.id === id ? { ...row, allowed: value } : row)),
);
};
const toggleRowSelection = (id: number) => {
setRowSelection((prev) => {
if (prev.includes(id)) {
return prev.filter((item) => item !== id);
} else {
return [...prev, id];
}
});
};
return (
<Dialog>
<DialogTrigger asChild>
<Button>IP 관리</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[600px]">
<DialogHeader>
<DialogTitle>IP 관리</DialogTitle>
</DialogHeader>
<div className="mb-4 flex justify-end gap-2">
<Button size="sm" color="green">
엑셀 업로드
</Button>
<Button size="sm" onClick={handleSave}>
저장
</Button>
<Button size="sm" color="white" onClick={handleAddIP}>
항목 추가
</Button>
<Button
size="sm"
color="red"
onClick={handleDeleteIP}
disabled={rowSelection.length === 0}
>
항목 삭제
</Button>
</div>
<div className="card card-border">
<Table>
<colgroup>
<col width="10%" />
<col width="10%" />
<col width="55%" />
<col width="25%" />
</colgroup>
<TableHeader>
<TableRow>
<TableHead>NO</TableHead>
<TableHead>선택</TableHead>
<TableHead>IP 주소</TableHead>
<TableHead>허용여부</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{rows.map((row, idx) => (
<TableRow key={row.id}>
<TableCell align="center">{idx + 1}</TableCell>
<TableCell align="center">
<Checkbox
checked={rowSelection.includes(row.id)}
onCheckedChange={() => toggleRowSelection(row.id)}
className="cursor-pointer"
/>
</TableCell>
<TableCell align="center">
<Input
value={row.ipAddress}
onChange={(e) =>
handleIPAddressChange(row.id, e.target.value)
}
className="!text-[1.3rem]"
/>
</TableCell>
<TableCell align="center">
<RadioGroup
value={row.allowed ? "true" : "false"}
onValueChange={(value) =>
handleAllowedChange(row.id, value === "true")
}
className="flex justify-center"
>
<div className="flex items-center space-x-2">
<RadioGroupItem value="true" id={`allow-${row.id}`} />
<label htmlFor={`allow-${row.id}`}>예</label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="false" id={`deny-${row.id}`} />
<label htmlFor={`deny-${row.id}`}>아니오</label>
</div>
</RadioGroup>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</DialogContent>
</Dialog>
);
}
export { IPManagementDialog };
+1 -1
View File
@@ -3,7 +3,7 @@ import { BaseLayout } from "@common/components";
function SitePageLayout({ children }: { children: React.ReactNode }) {
return (
<BaseLayout>
<div className="h-full bg-[#f1f6f9]">
<div className="h-auto min-h-full bg-[#f1f6f9]">
<h2 className="px-[1.8rem] pt-[2rem] text-[2.4rem] font-semibold text-[#4c5e6f]">
사이트 관리
</h2>
+20 -40
View File
@@ -15,7 +15,7 @@ import {
TableRow,
} from "@common/components";
import { SitePageLayout } from "./layout";
import { IPManagementDialog } from "./ip-management-dialog";
function RegisterPage() {
return (
<SitePageLayout>
@@ -24,20 +24,20 @@ function RegisterPage() {
<h3 className="text-2xl font-medium text-[#666]">사이트 등록/수정</h3>
</div>
<div className="card">
<Table>
<Table variant="secondary">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<TableBody>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 코드
</TableHead>
<TableHead>사이트 코드</TableHead>
<TableCell className="border">
<Input className="w-[12rem] !text-[1.3rem]" />
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 구분
</TableHead>
<TableHead>사이트 구분</TableHead>
<TableCell className="border">
<div className="flex gap-2">
<DropdownMenu>
@@ -57,14 +57,12 @@ function RegisterPage() {
</DropdownMenuContent>
</DropdownMenu>
</DropdownMenu>
<Button>IP 관리</Button>
<IPManagementDialog />
</div>
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 디자인
</TableHead>
<TableHead>사이트 디자인</TableHead>
<TableCell className="border">
<DropdownMenu>
<DropdownMenu>
@@ -86,9 +84,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트명
</TableHead>
<TableHead>사이트명</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -97,9 +93,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 설명
</TableHead>
<TableHead>사이트 설명</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -108,9 +102,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 하단 표기 주소
</TableHead>
<TableHead>사이트 하단 표기 주소</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -119,9 +111,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 하단 표기 전화번호
</TableHead>
<TableHead>사이트 하단 표기 전화번호</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -130,9 +120,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 하단 표기 팩스번호
</TableHead>
<TableHead>사이트 하단 표기 팩스번호</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -141,9 +129,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사이트 하단 표기 내용
</TableHead>
<TableHead>사이트 하단 표기 내용</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -152,9 +138,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
북마크 아이콘
</TableHead>
<TableHead>북마크 아이콘</TableHead>
<TableCell className="border">
<Input
className="!text-[1.3rem]"
@@ -163,9 +147,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
기본 사이트 여부
</TableHead>
<TableHead>기본 사이트 여부</TableHead>
<TableCell className="border">
<RadioGroup defaultValue="comfortable">
<div className="flex items-center space-x-2">
@@ -180,9 +162,7 @@ function RegisterPage() {
</TableCell>
</TableRow>
<TableRow>
<TableHead className="border bg-[#eaf3fb] text-[#647784]">
사용 여부
</TableHead>
<TableHead>사용 여부</TableHead>
<TableCell className="border">
<RadioGroup defaultValue="comfortable">
<div className="flex items-center space-x-2">
@@ -200,7 +180,7 @@ function RegisterPage() {
</Table>
</div>
</div>
<div className="mt-10 flex justify-center gap-4">
<div className="flex justify-center gap-4 pb-12 pt-10">
<Button size="lg">저장</Button>
<Button size="lg" color="white">
취소
+7 -1
View File
@@ -3,12 +3,18 @@
import "@common/assets/styles/grid.css";
import { useRouter } from "next/navigation";
import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
import { Button, Input, DataTable } from "@common/components";
import { data, columns } from "../model/__mocks__";
import { SitePageLayout } from "./layout";
function SitePage() {
const router = useRouter();
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
});
return (
<SitePageLayout>
@@ -28,7 +34,7 @@ function SitePage() {
<Button onClick={() => router.push("/site/register")}>등록</Button>
</div>
<div className="card !m-[1.2rem] h-[49rem] overflow-auto !p-0">
<DataTable data={data} columns={columns} />
<DataTable table={table} />
</div>
</div>
</div>
+2
View File
@@ -1,4 +1,5 @@
import type { Config } from "tailwindcss";
import tailwindcssAnimate from "tailwindcss-animate";
import presetConfig from "../../tailwind.config.preset";
export default {
@@ -15,4 +16,5 @@ export default {
},
},
},
plugins: [tailwindcssAnimate],
} satisfies Config;
+1
View File
@@ -25,6 +25,7 @@
"baseUrl": "./src",
"paths": {
"@/*": ["./*"],
"@common/components/*": ["../../../packages/common/components/src/*"],
"@common/components": ["../../../packages/common/components/src"]
}
},