diff --git a/apps/cs/middleware.ts b/apps/cs/middleware.ts index e7b03dddc..c9284d69b 100644 --- a/apps/cs/middleware.ts +++ b/apps/cs/middleware.ts @@ -5,10 +5,15 @@ const serverApiUrl = export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; + const searchParams = req.nextUrl.searchParams; + if (pathname.startsWith("/server")) { - return NextResponse.rewrite( - `${serverApiUrl}${pathname.replace("/server", "")}`, - ); + const queryParams = searchParams.toString(); + const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${ + queryParams ? `?${queryParams}` : "" + }`; + console.log("Rewriting to: ", newUrl); + return NextResponse.rewrite(new URL(newUrl)); } return NextResponse.next(); diff --git a/apps/cs/src/app/index.tsx b/apps/cs/src/app/index.tsx index d1d5e56e1..5a73f2fdd 100644 --- a/apps/cs/src/app/index.tsx +++ b/apps/cs/src/app/index.tsx @@ -1,10 +1,13 @@ import "./styles/base.css"; import "./styles/components.css"; import { AppProvider } from "./providers"; +import { cookies } from "next/headers"; + +const App = async ({ children }: Readonly<{ children: React.ReactNode }>) => { + const theme = (await cookies()).get("site-theme-key"); -const App = ({ children }: Readonly<{ children: React.ReactNode }>) => { return ( - + {children} diff --git a/apps/cs/src/app/providers/app-provider.tsx b/apps/cs/src/app/providers/app-provider.tsx index cf477dcc0..b14c3dc96 100644 --- a/apps/cs/src/app/providers/app-provider.tsx +++ b/apps/cs/src/app/providers/app-provider.tsx @@ -2,16 +2,18 @@ import { ConfirmProvider } from "@frontend-opensource/use-react-hooks"; import { AuthWrapper } from "@/entities/auth"; -import { QueryProvider, StoreProvider } from "@/shared/providers"; +import { StoreProvider } from "@/shared/providers"; +import { AlertDialog } from "@/shared/ui/alert-dialog"; const AppProvider = ({ children }: Readonly<{ children: React.ReactNode }>) => { return ( - - - {children} - - + + + {children} + + + ); }; diff --git a/apps/cs/src/app/styles/components.css b/apps/cs/src/app/styles/components.css index ec137cf25..b67efb8f0 100644 --- a/apps/cs/src/app/styles/components.css +++ b/apps/cs/src/app/styles/components.css @@ -14,7 +14,7 @@ @apply -mx-[0.6rem] mt-2 flex items-center justify-center border-t border-t-[#e1e7eb] py-4; } - [data-mode="dark"] { + [data-theme="black"] { .card-border { @apply border-[#3f4042] bg-[rgba(255,255,255,0.065)]; } diff --git a/apps/cs/src/pages/site/api/domain-service.ts b/apps/cs/src/pages/site/api/domain-service.ts new file mode 100644 index 000000000..7cc36363f --- /dev/null +++ b/apps/cs/src/pages/site/api/domain-service.ts @@ -0,0 +1,28 @@ +import { client } from "@/shared/api"; +import { ENDPOINT } from "@/shared/config"; +import type { + Domain, + DomainService, + DomainList, + IDomainParams, +} from "../model/domain-interface"; + +export class DomainApiService implements DomainService { + public async getDomainList(params: IDomainParams): Promise { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.DOMAINS}`, + { params }, + ); + return response.data; + } + + public async saveDomainList(body: Domain[]): Promise { + const response = await client.post( + `${ENDPOINT.CMS_SERVICE.DOMAINS}`, + body, + ); + return response.data; + } +} + +export const DomainApi = new DomainApiService(); diff --git a/apps/cs/src/pages/site/api/ip-service.ts b/apps/cs/src/pages/site/api/ip-service.ts new file mode 100644 index 000000000..748676b21 --- /dev/null +++ b/apps/cs/src/pages/site/api/ip-service.ts @@ -0,0 +1,22 @@ +import { client } from "@/shared/api"; +import { ENDPOINT } from "@/shared/config"; +import type { IIpParams, IP, IpList, IpService } from "../model/ip-interface"; + +export class IpApiService implements IpService { + public async getIpList(params: IIpParams): Promise { + const response = await client.get(`${ENDPOINT.CMS_SERVICE.IPS}`, { + params, + }); + return response.data; + } + + public async saveIpList(body: IP[]): Promise { + const response = await client.post( + `${ENDPOINT.CMS_SERVICE.IPS}`, + body, + ); + return response.data; + } +} + +export const IpApi = new IpApiService(); diff --git a/apps/cs/src/pages/site/api/site-service.ts b/apps/cs/src/pages/site/api/site-service.ts index 22363de68..629bf5f01 100644 --- a/apps/cs/src/pages/site/api/site-service.ts +++ b/apps/cs/src/pages/site/api/site-service.ts @@ -2,16 +2,16 @@ import { client } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import { siteFormSchema, - type ISiteInfo, type SiteService, + type SiteList, type ISiteDetail, type ISiteParams, type SiteFormData, } from "../model/site-interface"; export class SiteApiService implements SiteService { - public async siteInfo(params: ISiteParams): Promise { - const response = await client.get( + public async getSiteList(params: ISiteParams): Promise { + const response = await client.get( `${ENDPOINT.CMS_SERVICE.SITES}`, { params }, ); diff --git a/apps/cs/src/pages/site/model/domain-interface.ts b/apps/cs/src/pages/site/model/domain-interface.ts new file mode 100644 index 000000000..5f1076275 --- /dev/null +++ b/apps/cs/src/pages/site/model/domain-interface.ts @@ -0,0 +1,31 @@ +import { z } from "zod"; +import type { IPageableParams, PageableList } from "@/shared/model"; + +export interface IDomainParams extends IPageableParams { + keywordType?: string; + keyword?: string; + siteId?: string; + useYn?: string; +} + +export const domainSchema = z.object({ + siteDmnNo: z.number().nullish(), + siteId: z.string(), + dmnAddr: z.string().nonempty(), + useYn: z.string(), + rprsDmnYn: z.string(), + mode: z.string(), +}); + +export const domainFormSchema = z.object({ + domains: z.array(domainSchema), +}); + +export type Domain = z.infer; +export type DomainFormData = z.infer; +export type DomainList = PageableList; + +export interface DomainService { + getDomainList(params: IDomainParams): Promise; + saveDomainList(body: Domain[]): Promise; +} diff --git a/apps/cs/src/pages/site/model/ip-interface.ts b/apps/cs/src/pages/site/model/ip-interface.ts new file mode 100644 index 000000000..db1d393f1 --- /dev/null +++ b/apps/cs/src/pages/site/model/ip-interface.ts @@ -0,0 +1,29 @@ +import { z } from "zod"; +import type { IPageableParams, PageableList } from "@/shared/model"; + +export interface IIpParams extends IPageableParams { + siteId: string; + ipAddr?: string; + prmYn?: string; +} + +export const ipSchema = z.object({ + mngNo: z.number().nullish(), + siteId: z.string(), + ipAddr: z.string().nonempty(), + prmYn: z.string(), + mode: z.string(), +}); + +export const ipFormSchema = z.object({ + ips: z.array(ipSchema), +}); + +export type IP = z.infer; +export type IPFormData = z.infer; +export type IpList = PageableList; + +export interface IpService { + getIpList(params: IIpParams): Promise; + saveIpList(body: IP[]): Promise; +} diff --git a/apps/cs/src/pages/site/model/site-interface.ts b/apps/cs/src/pages/site/model/site-interface.ts index 4d03e2c8b..6edc1e69e 100644 --- a/apps/cs/src/pages/site/model/site-interface.ts +++ b/apps/cs/src/pages/site/model/site-interface.ts @@ -1,12 +1,10 @@ import { z } from "zod"; +import type { IPageableParams, PageableList } from "@/shared/model"; -export interface ISiteParams { - siteNm: string; - siteKndCd: string; - useYn: string; - page: number; - size: number; - sort: string[]; +export interface ISiteParams extends IPageableParams { + siteNm?: string; + siteKndCd?: string; + useYn?: string; } export interface ISite { @@ -20,35 +18,6 @@ export interface ISite { rgTrNm: string; } -export interface ISiteInfo { - totalPages: number; - totalElements: number; - number: number; - sort: { - empty: boolean; - sorted: boolean; - unsorted: boolean; - }; - size: number; - content: ISite[]; - pageable: { - sort: { - empty: boolean; - sorted: boolean; - unsorted: boolean; - }; - offset: number; - pageNumber: number; - pageSize: number; - paged: boolean; - unpaged: boolean; - }; - numberOfElements: number; - first: boolean; - last: boolean; - empty: boolean; -} - export interface ISiteDetail extends SiteFormData { siteId: string; siteKindNm: string; @@ -65,22 +34,23 @@ export interface ISiteDetail extends SiteFormData { export const siteFormSchema = z.object({ siteId: z.string().max(2).nonempty(), siteNm: z.string().max(100).nonempty(), - siteExpln: z.string().max(1000).optional(), + siteExpln: z.string().max(1000).nullable(), siteKndCd: z.string().max(10).nonempty(), - siteAddr: z.string().max(2000).optional(), - faxNo: z.string().max(100).optional(), - telNo: z.string().max(1000).optional(), - lwndCn: z.string().max(2000).optional(), + siteAddr: z.string().max(2000).nullable(), + faxNo: z.string().max(100).nullable(), + telNo: z.string().max(1000).nullable(), + lwndCn: z.string().max(2000).nullable(), bscSiteYn: z.string(), - bkmkIcon: z.string().max(100).optional(), + bkmkIcon: z.string().max(100).nullable(), useYn: z.string(), - siteSkn: z.string().max(10).optional(), + siteSkn: z.string().max(10).nullable(), }); export type SiteFormData = z.infer; +export type SiteList = PageableList; export interface SiteService { - siteInfo(query: ISiteParams): Promise; + getSiteList(params: ISiteParams): Promise; siteDetail(siteId: string): Promise; modifySite(siteId: string, data: SiteFormData): Promise; createSite(data: SiteFormData): Promise; diff --git a/apps/cs/src/pages/site/ui/create-page.tsx b/apps/cs/src/pages/site/ui/create-page.tsx index a79c16022..9e591d225 100644 --- a/apps/cs/src/pages/site/ui/create-page.tsx +++ b/apps/cs/src/pages/site/ui/create-page.tsx @@ -1,6 +1,5 @@ "use client"; -import { useState } from "react"; import { useRouter } from "next/navigation"; import { useForm } from "react-hook-form"; import { useMutation } from "@tanstack/react-query"; @@ -9,44 +8,39 @@ import { SiteApi } from "../api/site-service"; import { siteFormSchema, type SiteFormData } from "../model/site-interface"; import { SitePageLayout } from "./layout"; import { SiteForm } from "./site-form"; -import { - Button, - Dialog, - DialogClose, - DialogContent, - DialogFooter, -} from "@common/components/ui"; +import { useAlertStore } from "@/shared/lib/use-alert-store"; function CreatePage() { const router = useRouter(); + const { setMessage: alert } = useAlertStore((state) => state); const { mutateAsync: createSite } = useMutation({ mutationFn: (data: SiteFormData) => SiteApi.createSite(data), onSuccess: () => { - setIsCreateSuccess(true); + alert("등록되었습니다.", router.back); }, }); - const [isCreateSuccess, setIsCreateSuccess] = useState(false); - const form = useForm({ resolver: zodResolver(siteFormSchema), + defaultValues: { + siteId: "", + siteNm: "", + siteExpln: "", + siteKndCd: "", + siteAddr: "", + faxNo: "", + telNo: "", + lwndCn: "", + bscSiteYn: "", + bkmkIcon: "", + useYn: "", + siteSkn: "", + }, }); return ( - router.back()}> - -
-

등록되었습니다.

-
- - - - - -
-
); } diff --git a/apps/cs/src/pages/site/ui/domain-management-dialog.tsx b/apps/cs/src/pages/site/ui/domain-management-dialog.tsx index c675f92d9..4a7e854ee 100644 --- a/apps/cs/src/pages/site/ui/domain-management-dialog.tsx +++ b/apps/cs/src/pages/site/ui/domain-management-dialog.tsx @@ -1,4 +1,8 @@ import { useState } from "react"; +import { useMutation, useQuery } from "@tanstack/react-query"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { useForm, useFieldArray } from "react-hook-form"; import { Dialog, DialogTrigger, @@ -13,197 +17,304 @@ import { TableHeader, TableRow, Input, - Checkbox, - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + RadioGroup, + RadioGroupItem, DialogFooter, DialogClose, + Checkbox, } from "@common/components"; - -export type Domain = { - id: number; - domainUrl: string; - isRepresentative: boolean; - isActive: "true" | "false"; -}; +import { + Form, + FormControl, + FormField, + FormItem, + FormMessage, +} from "@/shared/ui/form"; +import { ENDPOINT } from "@/shared/config"; +import { DomainApi } from "../api/domain-service"; +import { + domainFormSchema, + type Domain, + type DomainFormData, +} from "../model/domain-interface"; +import { ConfirmDialog } from "@/shared/ui/confirm-dialog"; +import { useAlertStore } from "@/shared/lib/use-alert-store"; type DomainManagementDialogProps = { - triggerDisabled?: boolean; - handleSave: (rows: Domain[]) => void; + siteId: string; + open?: boolean; + onOpenChange?: (open: boolean) => void; + handleSaveDomain?: (rows: Domain[]) => void; }; function DomainManagementDialog({ - triggerDisabled, - handleSave, + siteId, + handleSaveDomain, + ...props }: DomainManagementDialogProps) { - const [rows, setRows] = useState([]); - const [rowSelection, setRowSelection] = useState([]); + const { confirm } = useConfirm(); + const { setMessage: alert } = useAlertStore((state) => state); - const onSave = () => { - handleSave(rows); + const { data: domainList } = useQuery({ + queryKey: [ENDPOINT.CMS_SERVICE.DOMAINS, props.open], + queryFn: () => DomainApi.getDomainList({ siteId }), + select: (data) => { + const domains = data.content.map((item) => ({ + ...item, + mode: "U", + })); + + initialForm(); + return domains; + }, + }); + + const { mutateAsync } = useMutation({ + mutationFn: (body: Domain[]) => DomainApi.saveDomainList(body), + }); + + const form = useForm({ + resolver: zodResolver(domainFormSchema), + values: { + domains: domainList ?? [], + }, + }); + const { fields, append, remove, update } = useFieldArray({ + control: form.control, + name: "domains", + }); + + const [onConfirm, setOnConfirm] = useState(false); + const [selectedRows, setSelectedRows] = useState([]); + + const initialForm = () => { + form.reset(); + setSelectedRows([]); + }; + + const onSubmit = async (data: DomainFormData) => { + setOnConfirm(true); + if (await confirm("저장하시겠습니까?")) { + setOnConfirm(false); + await mutateAsync(data.domains); + handleSaveDomain?.(data.domains); + alert("저장되었습니다."); + } + setOnConfirm(false); }; const handleAddDomain = () => { - const newDomain: Domain = { - id: Date.now(), - domainUrl: "", - isRepresentative: rows.length === 0, - isActive: "true", - }; - setRows([...rows, newDomain]); - }; - - const handleDeleteDomain = () => { - const filteredRows = rows.filter((row) => !rowSelection.includes(row.id)); - const hasRepresentative = filteredRows.some((row) => row.isRepresentative); - - let updatedRows = filteredRows; - if (!hasRepresentative && filteredRows.length > 0) { - updatedRows = filteredRows.map((row, index) => - index === 0 ? { ...row, isRepresentative: true } : row, - ); - } - - setRows(updatedRows); - setRowSelection([]); - }; - - const handleDomainUrlChange = (id: number, value: string) => { - setRows( - rows.map((row) => (row.id === id ? { ...row, domainUrl: value } : row)), - ); - }; - - const handleRepresentativeChange = (id: number) => { - setRows( - rows.map((row) => ({ - ...row, - isRepresentative: row.id === id, - })), - ); - }; - - const handleActiveChange = (id: number, value: "true" | "false") => { - setRows( - rows.map((row) => (row.id === id ? { ...row, isActive: value } : row)), - ); - }; - - const toggleRowSelection = (id: number) => { - setRowSelection((prev) => { - if (prev.includes(id)) { - return prev.filter((item) => item !== id); - } else { - return [...prev, id]; - } + append({ + siteDmnNo: null, + siteId, + dmnAddr: "", + useYn: "Y", + rprsDmnYn: "N", + mode: "C", }); }; + const handleSelectAll = () => { + if (selectedRows.length === fields.length) { + setSelectedRows([]); + } else { + setSelectedRows(fields.map((_, index) => index)); + } + }; + + const handleSelectRow = (i: number) => { + setSelectedRows((prev) => + prev.includes(i) ? prev.filter((j) => j !== i) : [...prev, i], + ); + }; + + const handleDeleteDomain = async () => { + if (selectedRows.length === 0) return; + + const sortedIndices = [...selectedRows].sort((a, b) => b - a); + sortedIndices.forEach((i) => { + const field = fields[i]; + if (field?.siteDmnNo) { + update(i, { + ...field, + mode: "D", + }); + } else { + remove(i); + } + }); + + setSelectedRows([]); + }; + + const handleChangeRprsDmnYn = (i: number) => { + fields.forEach((_, j) => { + if (j === i) return; + form.setValue(`domains.${j}.rprsDmnYn`, "N"); + }); + }; + + const isAllSelected = + fields.length > 0 && selectedRows.length === fields.length; + return ( - - - - - - - 도메인 관리 - -
- - -
-
- - - - - - - - - - - NO - 선택 - 도메인URL - 대표URL - 사용여부 - - - - {rows.map((row, idx) => ( - - {idx + 1} - - toggleRowSelection(row.id)} - className="cursor-pointer" - /> - - - - handleDomainUrlChange(row.id, e.target.value) - } - className="!text-[1.3rem]" - /> - - - handleRepresentativeChange(row.id)} - className="cursor-pointer" - /> - - - - - - ))} - -
-
- - - - - - - - -
-
+ <> + + + + + + + 도메인 관리 + +
+ { + e.preventDefault(); + e.stopPropagation(); + form.handleSubmit(onSubmit)(e); + }} + > +
+ + +
+
+ + + + + + + + + + + + + 도메인 주소 + 대표 URL + 사용여부 + + + + {fields.map((field, i) => { + if (field.mode === "D") return null; + return ( + + + handleSelectRow(i)} + /> + + + ( + + + + + + + )} + /> + + + ( + + + { + field.onChange(checked ? "Y" : "N"); + handleChangeRprsDmnYn(i); + }} + /> + + + + )} + /> + + + ( + + + +
+ + +
+
+ + +
+
+
+ +
+ )} + /> +
+
+ ); + })} +
+
+
+ + + + + + +
+ +
+
+ + ); } diff --git a/apps/cs/src/pages/site/ui/ip-management-dialog.tsx b/apps/cs/src/pages/site/ui/ip-management-dialog.tsx index 06d9638b3..97721a6d6 100644 --- a/apps/cs/src/pages/site/ui/ip-management-dialog.tsx +++ b/apps/cs/src/pages/site/ui/ip-management-dialog.tsx @@ -1,4 +1,8 @@ import { useState } from "react"; +import { useMutation, useQuery } from "@tanstack/react-query"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { useForm, useFieldArray } from "react-hook-form"; import { Dialog, DialogTrigger, @@ -15,162 +19,266 @@ import { Input, RadioGroup, RadioGroupItem, - Checkbox, DialogFooter, DialogClose, + Checkbox, } from "@common/components"; - -type IP = { - id: number; - ipAddress: string; - allowed: boolean; -}; +import { + Form, + FormControl, + FormField, + FormItem, + FormMessage, +} from "@/shared/ui/form"; +import { ENDPOINT } from "@/shared/config"; +import { IpApi } from "../api/ip-service"; +import { ipFormSchema, type IP, type IPFormData } from "../model/ip-interface"; +import { ConfirmDialog } from "@/shared/ui/confirm-dialog"; +import { useAlertStore } from "@/shared/lib/use-alert-store"; type IPManagementDialogProps = { + siteId: string; triggerDisabled?: boolean; + open?: boolean; + onOpenChange?: (open: boolean) => void; }; -function IPManagementDialog({ triggerDisabled }: IPManagementDialogProps) { - const [rows, setRows] = useState([]); - const [rowSelection, setRowSelection] = useState([]); +function IPManagementDialog({ + siteId, + triggerDisabled, + ...props +}: IPManagementDialogProps) { + const { confirm } = useConfirm(); + const { setMessage: alert } = useAlertStore((state) => state); - const onSave = () => {}; + const { data: ipList } = useQuery({ + queryKey: [ENDPOINT.CMS_SERVICE.IPS, props.open], + queryFn: () => IpApi.getIpList({ siteId, sort: [] }), + select: (data) => { + const ips = data.content.map((item) => ({ + ...item, + mode: "U", + })); + + initialForm(); + return ips; + }, + }); + + const { mutateAsync } = useMutation({ + mutationFn: (body: IP[]) => IpApi.saveIpList(body), + }); + + const form = useForm({ + resolver: zodResolver(ipFormSchema), + values: { + ips: ipList ?? [], + }, + }); + const { fields, append, remove, update } = useFieldArray({ + control: form.control, + name: "ips", + }); + + const [onConfirm, setOnConfirm] = useState(false); + const [selectedRows, setSelectedRows] = useState([]); + + const initialForm = () => { + form.reset(); + setSelectedRows([]); + }; + + const onSubmit = async (data: IPFormData) => { + setOnConfirm(true); + if (await confirm("저장하시겠습니까?")) { + setOnConfirm(false); + await mutateAsync(data.ips); + alert("저장되었습니다."); + } + }; 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]; - } + append({ + mngNo: null, + siteId, + ipAddr: "", + prmYn: "Y", + mode: "C", }); }; + const handleSelectAll = () => { + if (selectedRows.length === fields.length) { + setSelectedRows([]); + } else { + setSelectedRows(fields.map((_, index) => index)); + } + }; + + const handleSelectRow = (i: number) => { + setSelectedRows((prev) => + prev.includes(i) ? prev.filter((j) => j !== i) : [...prev, i], + ); + }; + + const handleDeleteIP = async () => { + if (selectedRows.length === 0) return; + + const sortedIndices = [...selectedRows].sort((a, b) => b - a); + sortedIndices.forEach((i) => { + const field = fields[i]; + if (field?.mngNo) { + update(i, { + ...field, + mode: "D", + }); + } else { + remove(i); + } + }); + + setSelectedRows([]); + }; + + const isAllSelected = + fields.length > 0 && selectedRows.length === fields.length; + return ( - - - - - - - IP 관리 - -
- - - -
-
- - - - - - - - - - NO - 선택 - IP 주소 - 허용여부 - - - - {rows.map((row, idx) => ( - - {idx + 1} - - toggleRowSelection(row.id)} - className="cursor-pointer" - /> - - - - handleIPAddressChange(row.id, e.target.value) - } - className="!text-[1.3rem]" - /> - - - - handleAllowedChange(row.id, value === "true") - } - className="flex justify-center" - > -
- - -
-
- - -
-
-
-
- ))} -
-
-
- - - - - - - - -
-
+ <> + + + + + + + IP 관리 + +
+ { + e.preventDefault(); + e.stopPropagation(); + form.handleSubmit(onSubmit)(e); + }} + > +
+ + +
+
+ + + + + + + + + + + + IP 주소 + 허용여부 + + + + {fields.map((field, i) => { + if (field.mode === "D") return null; + return ( + + + handleSelectRow(i)} + /> + + + ( + + + + + + + )} + /> + + + ( + + + +
+ + +
+
+ + +
+
+
+ +
+ )} + /> +
+
+ ); + })} +
+
+
+ + + + + + +
+ +
+
+ + ); } diff --git a/apps/cs/src/pages/site/ui/modify-page.tsx b/apps/cs/src/pages/site/ui/modify-page.tsx index 8c3bbd093..6cb394eae 100644 --- a/apps/cs/src/pages/site/ui/modify-page.tsx +++ b/apps/cs/src/pages/site/ui/modify-page.tsx @@ -1,73 +1,67 @@ "use client"; -import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import { useForm } from "react-hook-form"; -import { useMutation, useQuery } from "@tanstack/react-query"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { zodResolver } from "@hookform/resolvers/zod"; import { ENDPOINT } from "@/shared/config"; +import { useAlertStore } from "@/shared/lib/use-alert-store"; import { SiteApi } from "../api/site-service"; -import { - siteFormSchema, - type ISiteDetail, - type SiteFormData, -} from "../model/site-interface"; +import { siteFormSchema, type SiteFormData } from "../model/site-interface"; import { SitePageLayout } from "./layout"; import { SiteForm } from "./site-form"; -import { - Button, - Dialog, - DialogClose, - DialogContent, - DialogFooter, -} from "@common/components/ui"; function ModifyPage({ siteId }: { siteId: string }) { const isModifyMode = !!siteId; const router = useRouter(); + const queryClient = useQueryClient(); + const { setMessage: alert } = useAlertStore((state) => state); const { data: siteDetail } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.SITES, siteId], queryFn: () => SiteApi.siteDetail(siteId), - select: (data) => ({ - ...data, - faxNo: data.faxNumber, - bscSiteYn: data.basicSiteYn, - }), + select: (data) => { + const keys = Object.keys(siteFormSchema.shape); + const filteredData = Object.fromEntries( + Object.entries(data).filter(([key]) => keys.includes(key)), + ); + return { + ...filteredData, + faxNo: data.faxNumber, + bscSiteYn: data.basicSiteYn, + }; + }, enabled: isModifyMode, }); const { mutateAsync: modifySite } = useMutation({ mutationFn: (data: SiteFormData) => SiteApi.modifySite(siteId, data), onSuccess: () => { - setMessage("수정되었습니다."); + alert("수정되었습니다.", () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.CMS_SERVICE.SITES], + }); + }); }, }); const { mutateAsync: deleteSite } = useMutation({ mutationFn: () => SiteApi.deleteSite(siteId), onSuccess: () => { - setMessage("삭제되었습니다."); + alert("삭제되었습니다.", () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.CMS_SERVICE.SITES], + }); + router.back(); + }); }, }); - const [message, setMessage] = useState(""); const form = useForm({ resolver: zodResolver(siteFormSchema), + values: siteDetail as SiteFormData, }); - useEffect(() => { - if (!siteDetail) return; - - const keys = Object.keys(siteFormSchema.shape); - for (const key of keys) { - form.setValue( - key as keyof SiteFormData, - siteDetail[key as keyof ISiteDetail] ?? "", - ); - } - }, [siteDetail]); - return ( - router.back()}> - -
-

{message}

-
- - - - - -
-
); } diff --git a/apps/cs/src/pages/site/ui/site-form.tsx b/apps/cs/src/pages/site/ui/site-form.tsx index c554a868c..65d50159f 100644 --- a/apps/cs/src/pages/site/ui/site-form.tsx +++ b/apps/cs/src/pages/site/ui/site-form.tsx @@ -4,10 +4,6 @@ import { useConfirm } from "@frontend-opensource/use-react-hooks"; import { type UseFormReturn } from "react-hook-form"; import { Button, - Dialog, - DialogClose, - DialogContent, - DialogFooter, Input, Label, RadioGroup, @@ -26,47 +22,53 @@ import { Form, FormMessage, } from "@/shared/ui/form"; -import { type ISiteDetail, type SiteFormData } from "../model/site-interface"; +import { ConfirmDialog } from "@/shared/ui/confirm-dialog"; +import type { SiteFormData } from "../model/site-interface"; +import type { Domain } from "../model/domain-interface"; import { IPManagementDialog } from "./ip-management-dialog"; -import { - DomainManagementDialog, - type Domain, -} from "./domain-management-dialog"; +import { DomainManagementDialog } from "./domain-management-dialog"; type SiteFormProps = { form: UseFormReturn; siteId?: string; - handleSave: (data: SiteFormData) => void; - handleDelete?: () => void; + handleSave: (data: SiteFormData) => Promise; + handleDelete?: () => Promise; }; function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { - const router = useRouter(); - const { message, confirm, onConfirm, onCancel } = useConfirm(); - - const [viewState, setViewState] = useState>({}); - const [representativeDomain, setRepresentativeDomain] = useState(""); - const isModifyMode = !!siteId; - const handleViewStateChange = (key: keyof ISiteDetail) => (value: string) => { - setViewState({ ...viewState, [key]: value }); + const router = useRouter(); + const { confirm } = useConfirm(); + const [onConfirm, setOnConfirm] = useState(false); + const [isIpManagementOpen, setIsIpManagementOpen] = useState(false); + const [isDomainManagementOpen, setIsDomainManagementOpen] = useState(false); + const [domainUrl, setDomainUrl] = useState(""); + + const handleSaveDomain = (rows: Domain[]) => { + setDomainUrl(rows.find((row) => row.rprsDmnYn === "Y")?.dmnAddr || ""); }; - const handleDomainSave = (rows: Domain[]) => { - setRepresentativeDomain( - rows.find((row) => row.isRepresentative)?.domainUrl || "", - ); - }; + const onSubmit = async (data: SiteFormData) => { + const confirmMessage = isModifyMode + ? "수정하시겠습니까?" + : "저장하시겠습니까?"; - const onSubmit = (data: SiteFormData) => { - handleSave(data); + setOnConfirm(true); + if (await confirm(confirmMessage)) { + setOnConfirm(false); + handleSave(data); + } + setOnConfirm(false); }; const onDelete = async () => { - if (await confirm("정말 삭제하시겠습니까?")) { + setOnConfirm(true); + if (await confirm("삭제하시겠습니까?")) { + setOnConfirm(false); handleDelete?.(); } + setOnConfirm(false); }; return ( @@ -120,10 +122,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { { - handleViewStateChange("siteKndCd")(value); - field.onChange(value); - }} + onValueChange={field.onChange} /> @@ -132,7 +131,10 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { /> {isModifyMode && ( )} @@ -149,6 +151,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -191,6 +194,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -207,10 +211,13 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) {
- {representativeDomain} + {domainUrl}
@@ -227,6 +234,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -248,6 +256,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -269,6 +278,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -290,6 +300,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -311,6 +322,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { @@ -405,25 +417,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) { - - -
-

{message}

-
- - - - - - - - -
-
+ ); } diff --git a/apps/cs/src/pages/site/ui/site-page.tsx b/apps/cs/src/pages/site/ui/site-page.tsx index feace6285..8a2bd5264 100644 --- a/apps/cs/src/pages/site/ui/site-page.tsx +++ b/apps/cs/src/pages/site/ui/site-page.tsx @@ -7,7 +7,7 @@ import { useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { getCoreRowModel, useReactTable } from "@tanstack/react-table"; import { Button, DataTable, Input } from "@common/components"; -import { ENDPOINT } from "@/shared/config/api"; +import { ENDPOINT } from "@/shared/config"; import { SiteApi } from "../api/site-service"; import { columns } from "../model/table-columns"; import { type ISite, type ISiteParams } from "../model/site-interface"; @@ -15,23 +15,18 @@ import { SitePageLayout } from "./layout"; function SitePage() { const router = useRouter(); - const { data: siteInfo, refetch } = useQuery({ + const { data: siteList, refetch } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.SITES], - queryFn: () => SiteApi.siteInfo(siteQuery), + queryFn: () => SiteApi.getSiteList(siteQuery), enabled: false, }); const [siteQuery, setSiteQuery] = useState({ siteNm: "", - siteKndCd: "", - useYn: "", - page: 0, - size: 0, - sort: [], }); const table = useReactTable({ - data: siteInfo?.content ?? [], + data: siteList?.content ?? [], columns, getCoreRowModel: getCoreRowModel(), }); @@ -61,9 +56,7 @@ function SitePage() { - setSiteQuery({ ...siteQuery, siteNm: e.target.value }) - } + onChange={(e) => setSiteQuery({ siteNm: e.target.value })} /> + + + + + ); +} + +export { AlertDialog }; diff --git a/apps/cs/src/shared/ui/confirm-dialog.tsx b/apps/cs/src/shared/ui/confirm-dialog.tsx new file mode 100644 index 000000000..8f9ce2264 --- /dev/null +++ b/apps/cs/src/shared/ui/confirm-dialog.tsx @@ -0,0 +1,46 @@ +import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { + Dialog, + DialogContent, + DialogFooter, + DialogClose, + Button, + type ButtonProps, +} from "@common/components/ui"; + +type ConfirmDialogProps = { + open: boolean; + confirmButtonProps?: ButtonProps & { label?: string }; + cancelButtonProps?: ButtonProps & { label?: string }; +}; + +function ConfirmDialog({ + open, + confirmButtonProps, + cancelButtonProps, +}: ConfirmDialogProps) { + const { message, onConfirm, onCancel } = useConfirm(); + return ( + + +
+

{message}

+
+ + + + + + + + +
+
+ ); +} + +export { ConfirmDialog }; diff --git a/apps/cs/tailwind.config.ts b/apps/cs/tailwind.config.ts index 19ab5b282..9b4b42431 100644 --- a/apps/cs/tailwind.config.ts +++ b/apps/cs/tailwind.config.ts @@ -4,7 +4,6 @@ import presetConfig from "../../tailwind.config.preset"; export default { presets: [presetConfig], - darkMode: ["class", "[data-mode='dark']"], content: [ "./src/**/*.{js,ts,jsx,tsx,mdx}", "../../packages/common/components/src/ui/**/*.{js,ts,jsx,tsx,mdx}", diff --git a/packages/common/assets/src/styles/base.css b/packages/common/assets/src/styles/base.css index a99b29843..7fc103b43 100644 --- a/packages/common/assets/src/styles/base.css +++ b/packages/common/assets/src/styles/base.css @@ -45,7 +45,7 @@ --container: #f1f6f9; --title: #4c5e6f; } - [data-mode="dark"] { + [data-theme="black"] { --background: #0a0a0a; --foreground: #fafafa; --card: #0a0a0a; diff --git a/packages/common/components/.storybook/preview.tsx b/packages/common/components/.storybook/preview.tsx index c1d9f9154..b25bc00a2 100644 --- a/packages/common/components/.storybook/preview.tsx +++ b/packages/common/components/.storybook/preview.tsx @@ -25,10 +25,10 @@ const preview: Preview = { withThemeByDataAttribute({ themes: { light: "light", - dark: "dark", + black: "black", }, defaultTheme: "light", - attributeName: "data-mode", + attributeName: "data-theme", }), (Story) => (
diff --git a/packages/common/components/src/api/index.ts b/packages/common/components/src/api/index.ts index 98bc9323f..fd0c1fc18 100644 --- a/packages/common/components/src/api/index.ts +++ b/packages/common/components/src/api/index.ts @@ -1,3 +1,4 @@ export * from "./client"; export * from "./menu"; +export * from "./site"; export * from "./user"; diff --git a/packages/common/components/src/api/site.ts b/packages/common/components/src/api/site.ts new file mode 100644 index 000000000..77ed968e4 --- /dev/null +++ b/packages/common/components/src/api/site.ts @@ -0,0 +1,31 @@ +import { client } from "./client"; +import { ENDPOINT } from "../config"; + +export interface SiteInfo { + siteId: string; + siteNm: string; + siteExpln: string; + siteKndCd: string; + siteKindNm: string; + siteAddr: string; + faxNumber: string; + telNo: string; + lwndCn: string; + basicSiteYn: string; + bkmkIcon: string; + useYn: string; + siteSkn: string; + regDt: string; + rgTr: string; + mdfcnDt: string; + mdFr: string; + rgTrNm: string; + mdFrNm: string; +} + +export const getSiteInfo = async (siteId: string) => { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`, + ); + return response.data; +}; diff --git a/packages/common/components/src/config/api.ts b/packages/common/components/src/config/api.ts index 715f969d4..b06ffcd13 100644 --- a/packages/common/components/src/config/api.ts +++ b/packages/common/components/src/config/api.ts @@ -5,6 +5,7 @@ export const BASE_URL = `${PROXY_HOST}/server`; export const ENDPOINT = { CMS_SERVICE: { MENU_ROLES: "/cms-service/api/v1/menu-roles", + SITES: "/cms-service/api/v1/sites", }, USER_SERVICE: { USERS: "/user-service/api/v1/users", diff --git a/packages/common/components/src/lib/cookie.ts b/packages/common/components/src/lib/cookie.ts index a0fcf2bd9..8f5d0011b 100644 --- a/packages/common/components/src/lib/cookie.ts +++ b/packages/common/components/src/lib/cookie.ts @@ -10,7 +10,7 @@ export function getCookie(name: string): string | undefined { export function setCookie( name: string, value: string, - options: Cookies.CookieAttributes, + options?: Cookies.CookieAttributes, ): void { if (typeof window === "undefined") { return; @@ -20,29 +20,10 @@ export function setCookie( export function removeCookie( name: string, - options: Cookies.CookieAttributes, + options?: Cookies.CookieAttributes, ): void { if (typeof window === "undefined") { return; } Cookies.remove(name, options); } - -export function getToken(key: string): string | undefined { - return getCookie(key); -} - -export function setToken( - key: string, - token: string, - options: Cookies.CookieAttributes, -): void { - setCookie(key, token, { - ...options, - path: "/", - }); -} - -export function removeToken(key: string): void { - removeCookie(key, { path: "/" }); -} diff --git a/apps/cs/src/shared/providers/query-provider.tsx b/packages/common/components/src/provider/query-provider.tsx similarity index 50% rename from apps/cs/src/shared/providers/query-provider.tsx rename to packages/common/components/src/provider/query-provider.tsx index f16c42072..5781919f1 100644 --- a/apps/cs/src/shared/providers/query-provider.tsx +++ b/packages/common/components/src/provider/query-provider.tsx @@ -1,9 +1,14 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -const queryClient = new QueryClient(); - -export const QueryProvider = ({ children }: { children: React.ReactNode }) => { +export function QueryProvider({ + children, + client, +}: { + children: React.ReactNode; + client?: QueryClient; +}) { + const queryClient = client ?? new QueryClient(); return ( {children} ); -}; +} diff --git a/packages/common/components/src/ui/button-group/button-group.css b/packages/common/components/src/ui/button-group/button-group.css index c44fd7c04..5c6ae4c39 100644 --- a/packages/common/components/src/ui/button-group/button-group.css +++ b/packages/common/components/src/ui/button-group/button-group.css @@ -10,16 +10,16 @@ /* 버튼 색상 */ div[role="radiogroup"][data-variant="button"][data-color="primary"] { - @apply border border-primary dark:border-[#404040]; + @apply border border-primary; } div[role="radiogroup"][data-variant="button"][data-color="primary"] button { - @apply text-[#6f98bd] hover:bg-[#ecf3f9] hover:text-[#498bc7] data-[state=checked]:bg-primary data-[state=checked]:text-white dark:bg-[#505050] dark:text-[#aeb7bf] dark:hover:bg-[#525e69] dark:data-[state=checked]:bg-primary dark:data-[state=checked]:text-white; + @apply text-[#6f98bd] hover:bg-[#ecf3f9] hover:text-[#498bc7] data-[state=checked]:bg-primary data-[state=checked]:text-white; } div[role="radiogroup"][data-variant="button"][data-color="secondary"] { - @apply border border-[#ababab] dark:border-[#808080]; + @apply border border-[#ababab]; } div[role="radiogroup"][data-variant="button"][data-color="secondary"] button { - @apply bg-[#f3f3f3] text-[#8a8a8a] hover:bg-[#ececec] hover:text-[#808080] data-[state=checked]:bg-[#848484] data-[state=checked]:text-white dark:bg-[#505050] dark:text-[#a5a5a5] dark:hover:bg-[#444444] dark:data-[state=checked]:bg-[#848484] dark:data-[state=checked]:text-white; + @apply bg-[#f3f3f3] text-[#8a8a8a] hover:bg-[#ececec] hover:text-[#808080] data-[state=checked]:bg-[#848484] data-[state=checked]:text-white; } /* 버튼 모양 */ @@ -28,13 +28,37 @@ } div[role="radiogroup"][data-variant="button"][data-color="primary"][data-shape="rounded"] button { - @apply bg-[#70bcff] text-white hover:bg-[#6bb0ec] data-[state=checked]:bg-primary dark:bg-[#505050] dark:hover:bg-[#525e69] dark:data-[state=checked]:bg-primary; + @apply bg-[#70bcff] text-white hover:bg-[#6bb0ec] data-[state=checked]:bg-primary; } div[role="radiogroup"][data-variant="button"][data-color="secondary"][data-shape="rounded"] { @apply border-[#7b7b7b]; } div[role="radiogroup"][data-variant="button"][data-color="secondary"][data-shape="rounded"] button { - @apply bg-[#b7b7b7] text-white hover:bg-[#a9a9a9] data-[state=checked]:bg-[#797979] dark:bg-[#505050] dark:hover:bg-[#444444] dark:data-[state=checked]:bg-[#797979]; + @apply bg-[#b7b7b7] text-white hover:bg-[#a9a9a9] data-[state=checked]:bg-[#797979]; + } + + [data-theme="black"] { + div[role="radiogroup"][data-variant="button"][data-color="primary"] { + @apply border-[#404040]; + } + div[role="radiogroup"][data-variant="button"][data-color="primary"] button { + @apply bg-[#505050] text-[#aeb7bf] hover:bg-[#525e69] data-[state=checked]:bg-primary data-[state=checked]:text-white; + } + div[role="radiogroup"][data-variant="button"][data-color="secondary"] { + @apply border-[#808080]; + } + div[role="radiogroup"][data-variant="button"][data-color="secondary"] + button { + @apply bg-[#505050] text-[#a5a5a5] hover:bg-[#444444] data-[state=checked]:bg-[#848484] data-[state=checked]:text-white; + } + div[role="radiogroup"][data-variant="button"][data-color="primary"][data-shape="rounded"] + button { + @apply bg-[#505050] hover:bg-[#525e69] data-[state=checked]:bg-primary; + } + div[role="radiogroup"][data-variant="button"][data-color="secondary"][data-shape="rounded"] + button { + @apply bg-[#505050] hover:bg-[#444444] data-[state=checked]:bg-[#797979]; + } } } diff --git a/packages/common/components/src/ui/header/index.tsx b/packages/common/components/src/ui/header/index.tsx index cbeb95058..c9a150f58 100644 --- a/packages/common/components/src/ui/header/index.tsx +++ b/packages/common/components/src/ui/header/index.tsx @@ -1,8 +1,8 @@ import { useQuery } from "@tanstack/react-query"; import { images } from "@common/assets"; -import { getUserInfo } from "../../api"; -import { AUTH_USER_ID, ENDPOINT } from "../../config"; -import { getToken } from "../../lib"; +import { getCookie, setCookie } from "../../lib"; +import { getSiteInfo, getUserInfo } from "../../api"; +import { AUTH_USER_ID, ENDPOINT, SITE_ID } from "../../config"; import { DropdownMenu, DropdownMenuTrigger, @@ -12,13 +12,28 @@ import { import { Button } from "../button"; export function Header({ viewOnly }: { viewOnly?: boolean }) { - const userUniqId = getToken(AUTH_USER_ID) ?? ""; + const userUniqId = getCookie(AUTH_USER_ID) ?? ""; + const { data: userInfo } = useQuery({ queryKey: [ENDPOINT.USER_SERVICE.USERS], queryFn: () => getUserInfo(userUniqId), enabled: !viewOnly, }); + const { data: siteInfo } = useQuery({ + queryKey: [ENDPOINT.CMS_SERVICE.SITES, SITE_ID], + queryFn: () => getSiteInfo(SITE_ID), + select: (data) => { + if (data.siteSkn) { + const siteSkin = data.siteSkn.toLowerCase(); + setCookie("site-theme-key", siteSkin); + document.documentElement.setAttribute("data-theme", siteSkin); + } + return data; + }, + enabled: !viewOnly, + }); + return (
@@ -28,7 +43,7 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {

logo - 통합플랫폼관리 + {siteInfo?.siteNm}

diff --git a/packages/common/components/src/ui/layout/base.tsx b/packages/common/components/src/ui/layout/base.tsx index 1f2ad58a3..9dd778e03 100644 --- a/packages/common/components/src/ui/layout/base.tsx +++ b/packages/common/components/src/ui/layout/base.tsx @@ -1,17 +1,21 @@ -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; - +import { QueryProvider } from "../../provider/query-provider"; import { SidebarProvider } from "../sidebar"; import { LNB } from "../lnb"; import { Header } from "../header"; import { Footer } from "./footer"; import "./common.css"; +import type { QueryClient } from "@tanstack/react-query"; -const queryClient = new QueryClient(); - -export function BaseLayout({ children }: { children: React.ReactNode }) { +export function BaseLayout({ + children, + queryClient, +}: { + children: React.ReactNode; + queryClient?: QueryClient; +}) { return ( - +
@@ -26,6 +30,6 @@ export function BaseLayout({ children }: { children: React.ReactNode }) {
- + ); } diff --git a/packages/common/components/src/ui/layout/vbase.tsx b/packages/common/components/src/ui/layout/vbase.tsx index 43d3fdf1d..63c4e6d27 100644 --- a/packages/common/components/src/ui/layout/vbase.tsx +++ b/packages/common/components/src/ui/layout/vbase.tsx @@ -1,28 +1,35 @@ -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; - +import { QueryProvider } from "../../provider/query-provider"; +import { SidebarProvider } from "../sidebar"; import { LNB } from "../lnb"; import { Header } from "../header"; import { Footer } from "./footer"; import "./common.css"; +import type { QueryClient } from "@tanstack/react-query"; -const queryClient = new QueryClient(); - -export function VBaseLayout({ children }: { children: React.ReactNode }) { +export function BaseLayout({ + children, + queryClient, +}: { + children: React.ReactNode; + queryClient?: QueryClient; +}) { return ( - -
-
-
- -
-
- {children} + + +
+
+
+ +
+
+ {children} +
+
-
-
- + + ); } diff --git a/packages/common/components/src/ui/loading/loading.stories.tsx b/packages/common/components/src/ui/loading/loading.stories.tsx index ba59300af..54dcecd21 100644 --- a/packages/common/components/src/ui/loading/loading.stories.tsx +++ b/packages/common/components/src/ui/loading/loading.stories.tsx @@ -11,7 +11,7 @@ type Story = StoryObj; export const Primary: Story = { render: () => ( -
+
@@ -21,7 +21,7 @@ export const Primary: Story = { export const Secondary: Story = { render: () => ( -
+
@@ -31,7 +31,7 @@ export const Secondary: Story = { export const PrimaryWithImage: Story = { render: () => ( -
+
@@ -41,7 +41,7 @@ export const PrimaryWithImage: Story = { export const SecondaryWithImage: Story = { render: () => ( -
+
diff --git a/packages/common/components/src/ui/table/table.css b/packages/common/components/src/ui/table/table.css index 132239b57..08233787a 100644 --- a/packages/common/components/src/ui/table/table.css +++ b/packages/common/components/src/ui/table/table.css @@ -24,7 +24,7 @@ @apply border-b border-b-border; } - [data-mode="dark"] { + [data-theme="black"] { .table-ui th { @apply bg-[#5e7b9c] text-[#fff]; } diff --git a/packages/common/components/tailwind.config.js b/packages/common/components/tailwind.config.js index 5638e09ec..c6fc89183 100644 --- a/packages/common/components/tailwind.config.js +++ b/packages/common/components/tailwind.config.js @@ -3,7 +3,6 @@ import presetConfig from "../../../tailwind.config.preset"; /** @type {import('tailwindcss').Config} */ export default { presets: [presetConfig], - darkMode: ["class", "[data-mode='dark']"], content: ["./src/**/*.{ts,tsx,js,jsx}", "./.storybook/**/*.{ts,tsx,js,jsx}"], plugins: [require("tailwindcss-animate")], };