Skip to content

Commit

Permalink
전체 구조 수정 (#39)
Browse files Browse the repository at this point in the history
전체 구조 수정
  • Loading branch information
Dobbymin authored Oct 27, 2024
2 parents cf309ab + 1be27e2 commit 3c8b78c
Show file tree
Hide file tree
Showing 43 changed files with 71 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
env:
AWS_REGION: ap-northeast-2
ADMIN_BUCKET_NAME: vision.gdsc-knu.com
ADMIN_BUCKET_NAME: v-admin.gdsc-knu.com
permissions:
contents: read

Expand Down Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_ADMIN_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ADMIN_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Upload to AWS S3
Expand Down
Binary file modified packages/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/admin/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Routes } from "@/app/routes";
import { queryClient } from "@/shared/api/instance";
import { queryClient } from "@/shared";
import { QueryClientProvider } from "@tanstack/react-query";

function App() {
Expand Down
2 changes: 2 additions & 0 deletions packages/admin/src/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./lib";
export * from "./routes";
1 change: 1 addition & 0 deletions packages/admin/src/app/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { cn } from "./utils";
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { createBrowserRouter, Navigate, RouterProvider } from "react-router-dom";
import { createBrowserRouter, RouterProvider } from "react-router-dom";

import { RouterPath } from "./path";
import { PeopleManagementPage } from "@/feature/people-management";

const router = createBrowserRouter([
{
path: RouterPath.ROOT,
element: <Navigate to={RouterPath.ADMIN} replace />,
},
{
path: RouterPath.ADMIN,
element: <PeopleManagementPage />,
},
]);
Expand Down
2 changes: 2 additions & 0 deletions packages/admin/src/app/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { RouterPath } from "./path";
export { Routes } from "./Routes";
1 change: 0 additions & 1 deletion packages/admin/src/app/routes/path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const RouterPath = {
ROOT: "/",
ADMIN: "admin",
};
2 changes: 1 addition & 1 deletion packages/admin/src/feature/QR-code-scanner/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as QRCodeScannerPage } from "./ui";
export * from "./ui";
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useState, useCallback } from "react";

import { Button } from "@/shared/components/ui/button";
import { Button } from "@/shared";
import { Scanner } from "@yudiel/react-qr-scanner";

const QrCodeScannerPage = () => {
export const QRCodeScannerPage = () => {
const [scanning, setScanning] = useState(false);
const [scannedData, setScannedData] = useState<string | null>(null);

Expand Down Expand Up @@ -46,5 +46,3 @@ const QrCodeScannerPage = () => {
</div>
);
};

export default QrCodeScannerPage;
1 change: 1 addition & 0 deletions packages/admin/src/feature/QR-code-scanner/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { QRCodeScannerPage } from "./QRCodeScannerPage";
2 changes: 2 additions & 0 deletions packages/admin/src/feature/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./people-management";
export * from "./QR-code-scanner";
2 changes: 2 additions & 0 deletions packages/admin/src/feature/people-management/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// export * from "./hook";
export * from "./mock";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type { PeopleResponseData } from "./useGetPeople";
export { useGetPeople } from "./useGetPeople";
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { useState } from "react";

import { useGetPeople } from "../../api/mock/useGetPeople";
import useDeletePerson from "../../hook/useDeletePerson";
import useFilteredPeople from "../../hook/useFilteredPeople";
import useUpdatePersonStatus from "../../hook/useUpdatePersonStatus";
import InputField from "../feature/InputField";
import PeopleTable from "../feature/PeopleTable";

const MainContents = () => {
import {
InputField,
PeopleTable,
useDeletePerson,
useUpdatePersonStatus,
useFilteredPeople,
useGetPeople,
} from "@/feature";

export const MainContents = () => {
const [searchTerm, setSearchTerm] = useState("");

const { data } = useGetPeople();
Expand All @@ -26,5 +28,3 @@ const MainContents = () => {
</main>
);
};

export default MainContents;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MainContents } from "./MainContents";
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Props = {
setSearchTerm: (term: string) => void;
};

const InputField = ({ searchTerm, setSearchTerm }: Props) => {
export const InputField = ({ searchTerm, setSearchTerm }: Props) => {
return (
<div className="relative mb-4">
<input
Expand All @@ -19,5 +19,3 @@ const InputField = ({ searchTerm, setSearchTerm }: Props) => {
</div>
);
};

export default InputField;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
deletePerson: (id: number) => void;
};

const PeopleTable = ({ people, updatePersonStatus, deletePerson }: Props) => {
export const PeopleTable = ({ people, updatePersonStatus, deletePerson }: Props) => {
return (
<div className="overflow-x-auto bg-white rounded-lg shadow">
<table className="w-full">
Expand Down Expand Up @@ -88,5 +88,3 @@ const PeopleTable = ({ people, updatePersonStatus, deletePerson }: Props) => {
</div>
);
};

export default PeopleTable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { InputField } from "./InputField";
export { PeopleTable } from "./PeopleTable";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./common";
export * from "./feature";
3 changes: 3 additions & 0 deletions packages/admin/src/feature/people-management/hook/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { useDeletePerson } from "./useDeletePerson";
export { useFilteredPeople } from "./useFilteredPeople";
export { useUpdatePersonStatus } from "./useUpdatePersonStatus";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from "react";

import { PeopleResponseData } from "../api/mock/useGetPeople";

const useDeletePerson = (initialPeople: PeopleResponseData[]) => {
export const useDeletePerson = (initialPeople: PeopleResponseData[]) => {
const [people, setPeople] = useState<PeopleResponseData[]>(initialPeople);

const deletePerson = (id: number) => {
Expand All @@ -11,5 +11,3 @@ const useDeletePerson = (initialPeople: PeopleResponseData[]) => {

return { people, setPeople, deletePerson };
};

export default useDeletePerson;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from "react";

import { PeopleResponseData } from "../api/mock/useGetPeople";

const useFilteredPeople = (people: PeopleResponseData[], searchTerm: string) => {
export const useFilteredPeople = (people: PeopleResponseData[], searchTerm: string) => {
const filteredPeople = useMemo(() => {
return people.filter(
(person) =>
Expand All @@ -15,5 +15,3 @@ const useFilteredPeople = (people: PeopleResponseData[], searchTerm: string) =>

return filteredPeople;
};

export default useFilteredPeople;
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { PeopleResponseData } from "../api/mock/useGetPeople";

const useUpdatePersonStatus = (people: PeopleResponseData[], setPeople: (people: PeopleResponseData[]) => void) => {
export const useUpdatePersonStatus = (
people: PeopleResponseData[],
setPeople: (people: PeopleResponseData[]) => void,
) => {
const updatePersonStatus = (id: number, status: "accepted" | "rejected" | "checkedIn" | "checkedOut") => {
setPeople(
people.map((person) => {
Expand All @@ -25,5 +28,3 @@ const useUpdatePersonStatus = (people: PeopleResponseData[], setPeople: (people:

return updatePersonStatus;
};

export default useUpdatePersonStatus;
5 changes: 4 additions & 1 deletion packages/admin/src/feature/people-management/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export { default as PeopleManagementPage } from "./ui";
export * from "./api";
export * from "./hook";
export * from "./components";
export * from "./ui";
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useState } from "react";

import MainContents from "../components/common/MainContents";
import { QRCodeScannerPage } from "@/feature/QR-code-scanner";
import Header from "@/shared/components/feature/layout/header";
import Sidebar from "@/shared/components/feature/layout/sidebar";
import { MainContents, QRCodeScannerPage } from "@/feature";
import { Header, Sidebar } from "@/shared";

const PeopleManagementPage = () => {
export const PeopleManagementPage = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
const [activePage, setActivePage] = useState("people");

Expand All @@ -24,5 +22,3 @@ const PeopleManagementPage = () => {
</div>
);
};

export default PeopleManagementPage;
1 change: 1 addition & 0 deletions packages/admin/src/feature/people-management/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { PeopleManagementPage } from "./PeopleManagementPage";
1 change: 1 addition & 0 deletions packages/admin/src/shared/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./instance";
1 change: 1 addition & 0 deletions packages/admin/src/shared/api/instance/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { fetchInstance, queryClient } from "./Instance";
2 changes: 2 additions & 0 deletions packages/admin/src/shared/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Button, buttonVariants } from "./button";
export { Input } from "./input";
5 changes: 5 additions & 0 deletions packages/admin/src/shared/components/feature/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from "./layout";

export { Avatar, AvatarImage, AvatarFallback } from "./avatar";
export { ScrollArea, ScrollBar } from "./scroll-area";
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from "./table";
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Props = {
toggleSidebar: () => void;
};

const Header = ({ toggleSidebar }: Props) => {
export const Header = ({ toggleSidebar }: Props) => {
return (
<header className="flex items-center justify-between p-4 bg-white shadow-md lg:hidden">
<button className="p-2 rounded-md hover:bg-gray-100" onClick={toggleSidebar}>
Expand All @@ -14,5 +14,3 @@ const Header = ({ toggleSidebar }: Props) => {
</header>
);
};

export default Header;
2 changes: 2 additions & 0 deletions packages/admin/src/shared/components/feature/layout/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Header } from "./header";
export { Sidebar } from "./sidebar";
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {
setActivePage: (page: string) => void;
};

const Sidebar = ({ isSidebarOpen, activePage, setActivePage }: Props) => {
export const Sidebar = ({ isSidebarOpen, activePage, setActivePage }: Props) => {
return (
<aside className={`${isSidebarOpen ? "block" : "hidden"} lg:block w-full lg:w-64 bg-white shadow-md`}>
<nav className="flex flex-col p-4 space-y-2">
Expand All @@ -29,5 +29,3 @@ const Sidebar = ({ isSidebarOpen, activePage, setActivePage }: Props) => {
</aside>
);
};

export default Sidebar;
2 changes: 2 additions & 0 deletions packages/admin/src/shared/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./common";
export * from "./feature";
2 changes: 2 additions & 0 deletions packages/admin/src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./api";
export * from "./components";

0 comments on commit 3c8b78c

Please sign in to comment.