linkup-lib 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/CustomButton.d.ts +6 -0
  2. package/dist/CustomButton.js +21 -0
  3. package/dist/LinkupButton.d.ts +7 -0
  4. package/dist/LinkupButton.js +8 -0
  5. package/dist/Registry.d.ts +9 -0
  6. package/dist/Registry.js +16 -0
  7. package/dist/color.d.ts +7 -0
  8. package/dist/color.js +15 -0
  9. package/dist/compoenets/registry/AntdRegistry.d.ts +9 -0
  10. package/dist/compoenets/registry/AntdRegistry.js +13 -0
  11. package/dist/compoenets/registry/ErrorHandler.d.ts +2 -0
  12. package/dist/compoenets/registry/ErrorHandler.js +10 -0
  13. package/dist/compoenets/registry/NextAuthRegistry.d.ts +7 -0
  14. package/dist/compoenets/registry/NextAuthRegistry.js +13 -0
  15. package/dist/compoenets/registry/ReactQueryRegistry.d.ts +6 -0
  16. package/dist/compoenets/registry/ReactQueryRegistry.js +56 -0
  17. package/dist/compoenets/ui/header.d.ts +2 -0
  18. package/dist/compoenets/ui/header.js +29 -0
  19. package/dist/components/registry/AntdRegistry.d.ts +9 -0
  20. package/dist/components/registry/AntdRegistry.js +13 -0
  21. package/dist/components/registry/ErrorHandler.d.ts +2 -0
  22. package/dist/components/registry/ErrorHandler.js +10 -0
  23. package/dist/components/registry/ErrorRegistry.d.ts +5 -0
  24. package/dist/components/registry/ErrorRegistry.js +13 -0
  25. package/dist/components/registry/NextAuthRegistry.d.ts +7 -0
  26. package/dist/components/registry/NextAuthRegistry.js +13 -0
  27. package/dist/components/registry/ReactQueryRegistry.d.ts +6 -0
  28. package/dist/components/registry/ReactQueryRegistry.js +56 -0
  29. package/dist/components/ui/Aside.d.ts +14 -0
  30. package/dist/components/ui/Aside.js +133 -0
  31. package/dist/components/ui/Header.d.ts +5 -0
  32. package/dist/components/ui/Header.js +45 -0
  33. package/dist/components/ui/Header2.d.ts +5 -0
  34. package/dist/components/ui/Header2.js +20 -0
  35. package/dist/components/ui/Page.d.ts +5 -0
  36. package/dist/components/ui/Page.js +15 -0
  37. package/dist/components/ui/PageTitle.d.ts +7 -0
  38. package/dist/components/ui/PageTitle.js +21 -0
  39. package/dist/db.d.ts +4 -0
  40. package/dist/db.js +59 -0
  41. package/dist/image.d.ts +129 -0
  42. package/dist/image.js +158 -0
  43. package/dist/index.d.ts +133 -2
  44. package/dist/index.js +29 -9
  45. package/dist/util.d.ts +95 -0
  46. package/dist/util.js +254 -0
  47. package/package.json +34 -2
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from 'antd';
3
+ export interface CustomButtonProps extends ButtonProps {
4
+ customLabel?: string;
5
+ }
6
+ export declare const CustomButton: React.FC<CustomButtonProps>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.CustomButton = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const antd_1 = require("antd");
17
+ const CustomButton = (_a) => {
18
+ var { customLabel, children } = _a, props = __rest(_a, ["customLabel", "children"]);
19
+ return ((0, jsx_runtime_1.jsxs)(antd_1.Button, Object.assign({}, props, { type: "primary", children: [customLabel ? `[${customLabel}] ` : '', children] })));
20
+ };
21
+ exports.CustomButton = CustomButton;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface LinkupButtonProps {
3
+ onClick?: () => void;
4
+ children: React.ReactNode;
5
+ style?: React.CSSProperties;
6
+ }
7
+ export declare const LinkupButton: React.FC<LinkupButtonProps>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkupButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const LinkupButton = ({ onClick, children, style }) => {
6
+ return ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, style: Object.assign({ padding: '10px 20px', backgroundColor: '#0070f3', color: 'white', border: 'none', borderRadius: '5px', cursor: 'pointer' }, style), children: children }));
7
+ };
8
+ exports.LinkupButton = LinkupButton;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ThemeConfig } from 'antd';
3
+ export interface RegistryProps {
4
+ size?: 'small' | 'middle' | 'large';
5
+ theme: ThemeConfig;
6
+ children: React.ReactNode;
7
+ }
8
+ declare const Registry: ({ size, theme, children }: RegistryProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default Registry;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const NextAuthRegistry_1 = __importDefault(require("./components/registry/NextAuthRegistry"));
9
+ const AntdRegistry_1 = __importDefault(require("./components/registry/AntdRegistry"));
10
+ const ReactQueryRegistry_1 = __importDefault(require("./components/registry/ReactQueryRegistry"));
11
+ const react_error_boundary_1 = require("react-error-boundary");
12
+ const ErrorHandler_1 = __importDefault(require("./components/registry/ErrorHandler"));
13
+ const Registry = ({ size, theme, children }) => {
14
+ return ((0, jsx_runtime_1.jsx)(NextAuthRegistry_1.default, { session: true, children: (0, jsx_runtime_1.jsx)(AntdRegistry_1.default, { theme: theme, size: size, children: (0, jsx_runtime_1.jsx)(ReactQueryRegistry_1.default, { children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorHandler_1.default, children: children }) }) }) }));
15
+ };
16
+ exports.default = Registry;
@@ -0,0 +1,7 @@
1
+ declare const primary = "#E2702F";
2
+ declare const secondary = "#0F1C43";
3
+ declare const bg100 = "#2F3539";
4
+ declare const bg200 = "#434B59";
5
+ declare const bg300 = "#495160";
6
+ declare const bg900 = "#EEF0F5";
7
+ export { primary, secondary, bg100, bg200, bg300, bg900 };
package/dist/color.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bg900 = exports.bg300 = exports.bg200 = exports.bg100 = exports.secondary = exports.primary = void 0;
4
+ const primary = "#E2702F";
5
+ exports.primary = primary;
6
+ const secondary = "#0F1C43";
7
+ exports.secondary = secondary;
8
+ const bg100 = "#2F3539";
9
+ exports.bg100 = bg100;
10
+ const bg200 = "#434B59";
11
+ exports.bg200 = bg200;
12
+ const bg300 = "#495160";
13
+ exports.bg300 = bg300;
14
+ const bg900 = "#EEF0F5";
15
+ exports.bg900 = bg900;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ThemeConfig } from 'antd';
3
+ interface RootLayoutProps {
4
+ size?: 'small' | 'middle' | 'large';
5
+ theme: ThemeConfig;
6
+ children: React.ReactNode;
7
+ }
8
+ declare const RootLayout: ({ size, theme, children }: RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default RootLayout;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const antd_1 = require("antd");
9
+ const nextjs_registry_1 = require("@ant-design/nextjs-registry");
10
+ // 한국어
11
+ const ko_KR_1 = __importDefault(require("antd/es/locale/ko_KR"));
12
+ const RootLayout = ({ size = 'small', theme, children }) => ((0, jsx_runtime_1.jsx)(nextjs_registry_1.AntdRegistry, { children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { componentSize: size, theme: theme, locale: ko_KR_1.default, children: children }) }));
13
+ exports.default = RootLayout;
@@ -0,0 +1,2 @@
1
+ declare const ErrorHandler: ({ error, resetErrorBoundary }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default ErrorHandler;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const antd_1 = require("antd");
6
+ const tb_1 = require("react-icons/tb");
7
+ const ErrorHandler = ({ error, resetErrorBoundary }) => {
8
+ return ((0, jsx_runtime_1.jsx)("div", { style: { minHeight: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', paddingBottom: '30vh' }, children: (0, jsx_runtime_1.jsx)(antd_1.Result, { status: "error", title: "Error", subTitle: "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.", extra: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("pre", { style: { padding: 20, background: '#f9f9f9', borderRadius: 12 }, children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Text, { style: { fontSize: 12, color: '#999' }, children: typeof error === "string" ? error : error.message }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(antd_1.Button, { onClick: resetErrorBoundary, icon: (0, jsx_runtime_1.jsx)(tb_1.TbRefresh, {}), children: "\uC7AC\uC2DC\uB3C4" })] }) }) }));
9
+ };
10
+ exports.default = ErrorHandler;
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface Props {
3
+ session: any;
4
+ children: ReactNode | ReactNode[];
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ children }: Props) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("next-auth/react");
9
+ const react_2 = __importDefault(require("react"));
10
+ const Components = ({ children }) => {
11
+ return ((0, jsx_runtime_1.jsx)(react_1.SessionProvider, { children: children }));
12
+ };
13
+ exports.default = react_2.default.memo(Components);
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface Props {
3
+ children: ReactNode | ReactNode[];
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ children }: Props) => import("react/jsx-runtime").JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_query_1 = require("@tanstack/react-query");
9
+ const react_1 = __importDefault(require("react"));
10
+ const Components = ({ children }) => {
11
+ const errorHandler = (error) => {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13
+ // 401 에러 처리
14
+ if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) === 419) {
15
+ alert("접근 권한이 없습니다.\n다시 로그인 해주세요.");
16
+ window.location.href = '/auth/signin';
17
+ }
18
+ // 404 에러 처리
19
+ else if (((_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.status) === 404) {
20
+ alert("잘못된 접근입니다.");
21
+ }
22
+ // 400 에러 처리
23
+ else if (((_d = error === null || error === void 0 ? void 0 : error.response) === null || _d === void 0 ? void 0 : _d.status) === 400) {
24
+ alert(((_f = (_e = error === null || error === void 0 ? void 0 : error.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.message) || "잘못된 요청입니다.");
25
+ }
26
+ // 500 에러 처리
27
+ else if (((_g = error === null || error === void 0 ? void 0 : error.response) === null || _g === void 0 ? void 0 : _g.status) === 500) {
28
+ alert(((_j = (_h = error === null || error === void 0 ? void 0 : error.response) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.message) || "잘못된 요청입니다.");
29
+ }
30
+ else {
31
+ alert("잘못된 요청입니다.");
32
+ }
33
+ };
34
+ const queryClient = new react_query_1.QueryClient({
35
+ defaultOptions: {
36
+ queries: {
37
+ // 모든 Query의 오류를 공통으로 처리한다.
38
+ throwOnError(error, query) {
39
+ // 에러 처리
40
+ errorHandler(error);
41
+ return false;
42
+ },
43
+ retry: process.env.NODE_ENV === 'production' ? 3 : 0, // 프로덕션 환경에서만 재시도
44
+ retryDelay: attemptIndex => Math.min(1000 * 2 ** attemptIndex, 30000), // 지수 백오프 전략
45
+ },
46
+ mutations: {
47
+ onError(error, variables, onMutateResult, context) {
48
+ // 에러 처리
49
+ errorHandler(error);
50
+ },
51
+ }
52
+ },
53
+ });
54
+ return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: children }));
55
+ };
56
+ exports.default = react_1.default.memo(Components);
@@ -0,0 +1,2 @@
1
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Component;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const antd_1 = require("antd");
6
+ const react_1 = require("next-auth/react");
7
+ const navigation_1 = require("next/navigation");
8
+ const Component = () => {
9
+ var _a;
10
+ // 라우터
11
+ const router = (0, navigation_1.useRouter)();
12
+ // 세션
13
+ const session = (0, react_1.useSession)();
14
+ const user = (_a = session.data) === null || _a === void 0 ? void 0 : _a.user;
15
+ // 로그아웃
16
+ const handleLogout = () => {
17
+ (0, react_1.signOut)();
18
+ };
19
+ return ((0, jsx_runtime_1.jsxs)("header", { className: "bg-bg-300 w-full h-14 flex fixed top-0 left-0 z-10 items-center", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center pl-6 gap-2 cursor-pointer", onClick: () => {
20
+ router.push('/');
21
+ }, children: [(0, jsx_runtime_1.jsx)(antd_1.Image, { preview: false, height: 423 / 12, width: 821 / 12, src: "https://secret-order.s3.ap-northeast-2.amazonaws.com/banner/20260107141238977.webp" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-0.5", children: (0, jsx_runtime_1.jsx)("p", { className: `text-2xl text-zinc-200 font-semibold`, children: "\uC720\uD1B5\uC0AC \uAD00\uB9AC\uC790" }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1" }), (0, jsx_runtime_1.jsx)("div", { className: "pr-6", children:
22
+ // 로그인 됨
23
+ user ?
24
+ (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "cursor-pointer", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-white", children: [user.id, " \uB2D8"] }) }), (0, jsx_runtime_1.jsx)("div", { className: "cursor-pointer", onClick: handleLogout, children: (0, jsx_runtime_1.jsx)("p", { className: "text-white", children: "\uB85C\uADF8\uC544\uC6C3" }) })] })
25
+ :
26
+ // 로그인 안됨
27
+ (0, jsx_runtime_1.jsx)("div", {}) })] }));
28
+ };
29
+ exports.default = Component;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ThemeConfig } from 'antd';
3
+ export interface RootLayoutProps {
4
+ size?: 'small' | 'middle' | 'large';
5
+ theme: ThemeConfig;
6
+ children: React.ReactNode;
7
+ }
8
+ declare const RootLayout: ({ size, theme, children }: RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default RootLayout;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const antd_1 = require("antd");
9
+ const nextjs_registry_1 = require("@ant-design/nextjs-registry");
10
+ // 한국어
11
+ const ko_KR_1 = __importDefault(require("antd/es/locale/ko_KR"));
12
+ const RootLayout = ({ size = 'small', theme, children }) => ((0, jsx_runtime_1.jsx)(nextjs_registry_1.AntdRegistry, { children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { componentSize: size, theme: theme, locale: ko_KR_1.default, children: children }) }));
13
+ exports.default = RootLayout;
@@ -0,0 +1,2 @@
1
+ declare const ErrorHandler: ({ error, resetErrorBoundary }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default ErrorHandler;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const antd_1 = require("antd");
6
+ const tb_1 = require("react-icons/tb");
7
+ const ErrorHandler = ({ error, resetErrorBoundary }) => {
8
+ return ((0, jsx_runtime_1.jsx)("div", { style: { minHeight: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', paddingBottom: '30vh' }, children: (0, jsx_runtime_1.jsx)(antd_1.Result, { status: "error", title: "Error", subTitle: "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.", extra: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("pre", { style: { padding: 20, background: '#f9f9f9', borderRadius: 12 }, children: (0, jsx_runtime_1.jsx)(antd_1.Typography.Text, { style: { fontSize: 12, color: '#999' }, children: typeof error === "string" ? error : error.message }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(antd_1.Button, { onClick: resetErrorBoundary, icon: (0, jsx_runtime_1.jsx)(tb_1.TbRefresh, {}), children: "\uC7AC\uC2DC\uB3C4" })] }) }) }));
9
+ };
10
+ exports.default = ErrorHandler;
@@ -0,0 +1,5 @@
1
+ export interface Props {
2
+ children: React.ReactNode | React.ReactNode[];
3
+ }
4
+ declare const Component: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_error_boundary_1 = require("react-error-boundary");
9
+ const ErrorHandler_1 = __importDefault(require("./ErrorHandler"));
10
+ const Component = ({ children }) => {
11
+ return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorHandler_1.default, children: children }));
12
+ };
13
+ exports.default = Component;
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface Props {
3
+ session: any;
4
+ children: ReactNode | ReactNode[];
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ children }: Props) => import("react/jsx-runtime").JSX.Element>;
7
+ export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("next-auth/react");
9
+ const react_2 = __importDefault(require("react"));
10
+ const Components = ({ children }) => {
11
+ return ((0, jsx_runtime_1.jsx)(react_1.SessionProvider, { children: children }));
12
+ };
13
+ exports.default = react_2.default.memo(Components);
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface Props {
3
+ children: ReactNode | ReactNode[];
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ children }: Props) => import("react/jsx-runtime").JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_query_1 = require("@tanstack/react-query");
9
+ const react_1 = __importDefault(require("react"));
10
+ const Components = ({ children }) => {
11
+ const errorHandler = (error) => {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13
+ // 401 에러 처리
14
+ if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) === 419) {
15
+ alert("접근 권한이 없습니다.\n다시 로그인 해주세요.");
16
+ window.location.href = '/auth/signin';
17
+ }
18
+ // 404 에러 처리
19
+ else if (((_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.status) === 404) {
20
+ alert("잘못된 접근입니다.");
21
+ }
22
+ // 400 에러 처리
23
+ else if (((_d = error === null || error === void 0 ? void 0 : error.response) === null || _d === void 0 ? void 0 : _d.status) === 400) {
24
+ alert(((_f = (_e = error === null || error === void 0 ? void 0 : error.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.message) || "잘못된 요청입니다.");
25
+ }
26
+ // 500 에러 처리
27
+ else if (((_g = error === null || error === void 0 ? void 0 : error.response) === null || _g === void 0 ? void 0 : _g.status) === 500) {
28
+ alert(((_j = (_h = error === null || error === void 0 ? void 0 : error.response) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.message) || "잘못된 요청입니다.");
29
+ }
30
+ else {
31
+ alert("잘못된 요청입니다.");
32
+ }
33
+ };
34
+ const queryClient = new react_query_1.QueryClient({
35
+ defaultOptions: {
36
+ queries: {
37
+ // 모든 Query의 오류를 공통으로 처리한다.
38
+ throwOnError(error, query) {
39
+ // 에러 처리
40
+ errorHandler(error);
41
+ return false;
42
+ },
43
+ retry: process.env.NODE_ENV === 'production' ? 3 : 0, // 프로덕션 환경에서만 재시도
44
+ retryDelay: attemptIndex => Math.min(1000 * 2 ** attemptIndex, 30000), // 지수 백오프 전략
45
+ },
46
+ mutations: {
47
+ onError(error, variables, onMutateResult, context) {
48
+ // 에러 처리
49
+ errorHandler(error);
50
+ },
51
+ }
52
+ },
53
+ });
54
+ return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: children }));
55
+ };
56
+ exports.default = react_1.default.memo(Components);
@@ -0,0 +1,14 @@
1
+ export declare const asideAtom: import("jotai").PrimitiveAtom<boolean> & {
2
+ init: boolean;
3
+ };
4
+ interface MenusProps {
5
+ key: string;
6
+ label: string;
7
+ items?: MenusProps[];
8
+ }
9
+ export interface AsideProps {
10
+ primaryColor?: string;
11
+ menus: MenusProps[];
12
+ }
13
+ declare const Component: ({ primaryColor, menus }: AsideProps) => import("react/jsx-runtime").JSX.Element;
14
+ export default Component;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.asideAtom = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("next-auth/react");
7
+ const navigation_1 = require("next/navigation");
8
+ const react_2 = require("react");
9
+ const fi_1 = require("react-icons/fi");
10
+ const im_1 = require("react-icons/im");
11
+ const jotai_1 = require("jotai");
12
+ exports.asideAtom = (0, jotai_1.atom)(true);
13
+ const Component = ({ primaryColor = "#E2702F", menus }) => {
14
+ var _a;
15
+ // 세션
16
+ const session = (0, react_1.useSession)();
17
+ const user = (_a = session.data) === null || _a === void 0 ? void 0 : _a.user;
18
+ // 사이드바 열림 상태
19
+ const [asideOpen, setAsideOpen] = (0, jotai_1.useAtom)(exports.asideAtom);
20
+ return ((0, jsx_runtime_1.jsxs)("aside", { style: {
21
+ position: "fixed",
22
+ top: 0,
23
+ left: 0,
24
+ width: asideOpen ? 210 : 0,
25
+ minHeight: "100dvh",
26
+ height: '100dvh',
27
+ overflow: 'auto',
28
+ backgroundColor: "#434B59",
29
+ zIndex: 10,
30
+ paddingTop: 56,
31
+ transition: 'all 300ms',
32
+ scrollbarWidth: 'none',
33
+ }, children: [(0, jsx_runtime_1.jsx)("style", { children: `
34
+ aside::-webkit-scrollbar {
35
+ display: none;
36
+ }
37
+ ` }), (0, jsx_runtime_1.jsxs)("div", { style: {
38
+ padding: '0px 0px',
39
+ minWidth: 210,
40
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
41
+ display: 'flex',
42
+ flexDirection: 'column',
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ padding: '30px 12px'
46
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
47
+ width: 80, height: 80,
48
+ borderRadius: "100%",
49
+ background: '#EBF0F1',
50
+ marginBottom: 20,
51
+ display: 'flex',
52
+ alignItems: 'flex-end',
53
+ justifyContent: 'center',
54
+ overflow: 'hidden',
55
+ }, children: (0, jsx_runtime_1.jsx)(im_1.ImUser, { style: { fontSize: 75, color: "#C7CAD2", transform: "translateY(6px)" } }) }), (0, jsx_runtime_1.jsx)("p", { style: { color: 'white', fontSize: 15, fontWeight: 'bold' }, children: user ? user.name : "" }), (0, jsx_runtime_1.jsx)("p", { style: { color: '#bbb', fontSize: 12 }, children: user ? user.levelName : "" })] }), (0, jsx_runtime_1.jsx)("ul", { style: {
56
+ borderTop: '1px solid #5F6673',
57
+ }, children: menus.map((r, idx) => {
58
+ return ((0, jsx_runtime_1.jsx)(Menu, { menu: r, primaryColor: primaryColor }, `menu-${r.key}`));
59
+ }) })] })] }));
60
+ };
61
+ // 메뉴 컴포넌트
62
+ const Menu = ({ menu, primaryColor }) => {
63
+ // 활성 메뉴
64
+ const pathname = (0, navigation_1.usePathname)();
65
+ const isActive = (0, react_2.useMemo)(() => {
66
+ if (!pathname)
67
+ return "";
68
+ const pathArr = pathname.split('/');
69
+ if (pathArr[1] === "")
70
+ return false;
71
+ return pathArr[1] === menu.key;
72
+ }, [pathname, menu.key]);
73
+ const [open, setOpen] = (0, react_2.useState)(isActive);
74
+ const router = (0, navigation_1.useRouter)();
75
+ return ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
76
+ height: 48,
77
+ width: '100%',
78
+ display: 'flex',
79
+ alignItems: 'center',
80
+ justifyContent: 'space-between',
81
+ borderBottom: '1px solid #5F6673',
82
+ padding: '0px 20px',
83
+ cursor: 'pointer',
84
+ }, onClick: () => {
85
+ if (menu.items && menu.items.length > 0)
86
+ setOpen(!open);
87
+ else
88
+ router.push(`/${menu.key}`);
89
+ }, children: [(0, jsx_runtime_1.jsx)("p", { style: { color: 'white', fontWeight: 'bold', fontSize: '15px' }, children: menu.label }), menu.items && menu.items.length > 0 ?
90
+ (0, jsx_runtime_1.jsx)(fi_1.FiChevronDown, { style: { color: '#6B7280', transition: '300ms', rotate: open ? '180deg' : '0deg' } })
91
+ : null] }), menu.items ?
92
+ (0, jsx_runtime_1.jsx)("ul", { style: {
93
+ width: '100%', backgroundColor: '#484E5C', maxHeight: open ? 500 : 0, overflow: 'hidden', transition: '300ms',
94
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
95
+ padding: '10px 16px',
96
+ borderBottom: '1px solid #5F6673',
97
+ }, children: menu.items.map((r, i) => {
98
+ return ((0, jsx_runtime_1.jsx)(SubMenu, { menu: r, primaryColor: primaryColor }, `sub-menu-${i}-${r.key}`));
99
+ }) }) })
100
+ : null] }));
101
+ };
102
+ const SubMenu = ({ menu, primaryColor }) => {
103
+ // 호버 상태
104
+ const [isHover, setIsHover] = (0, react_2.useState)(false);
105
+ const router = (0, navigation_1.useRouter)();
106
+ // 활성 메뉴
107
+ const pathname = (0, navigation_1.usePathname)();
108
+ const isActive = (0, react_2.useMemo)(() => {
109
+ if (!pathname)
110
+ return "";
111
+ const pathArr = pathname.split('/');
112
+ if (pathArr[1] === "")
113
+ return false;
114
+ else
115
+ return `${pathArr[1]}/${pathArr[2]}` === menu.key;
116
+ }, [pathname, menu.key]);
117
+ return ((0, jsx_runtime_1.jsx)("li", { style: {
118
+ height: 48,
119
+ display: 'flex',
120
+ alignItems: 'center',
121
+ cursor: 'pointer',
122
+ }, onMouseEnter: () => setIsHover(true), onMouseLeave: () => setIsHover(false), onClick: () => router.push(`/${menu.key}`), children: (0, jsx_runtime_1.jsx)("div", { style: {
123
+ width: '100%',
124
+ padding: '10px 14px',
125
+ borderRadius: 8,
126
+ background: isActive ? '#2A2F37' : 'transparent',
127
+ }, children: (0, jsx_runtime_1.jsx)("p", { style: {
128
+ fontWeight: isActive ? '900' : '600',
129
+ color: isHover || isActive ? primaryColor : 'rgb(211, 218, 223)',
130
+ fontSize: 14,
131
+ }, children: menu.label }) }) }));
132
+ };
133
+ exports.default = Component;
@@ -0,0 +1,5 @@
1
+ export interface HeaderProps {
2
+ logo: React.ReactNode;
3
+ }
4
+ declare const Component: ({ logo }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("next-auth/react");
6
+ const navigation_1 = require("next/navigation");
7
+ const color_1 = require("../../color");
8
+ const Component = ({ logo }) => {
9
+ var _a;
10
+ // 라우터
11
+ const router = (0, navigation_1.useRouter)();
12
+ // 세션
13
+ const session = (0, react_1.useSession)();
14
+ const user = (_a = session.data) === null || _a === void 0 ? void 0 : _a.user;
15
+ // 로그아웃
16
+ const handleLogout = () => {
17
+ (0, react_1.signOut)();
18
+ };
19
+ return ((0, jsx_runtime_1.jsxs)("header", { style: {
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ width: '100%',
23
+ height: '56px',
24
+ position: 'fixed',
25
+ top: 0,
26
+ left: 0,
27
+ zIndex: 20,
28
+ background: color_1.bg100,
29
+ }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { style: {
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ paddingLeft: '24px',
34
+ cursor: 'pointer',
35
+ }, onClick: () => {
36
+ router.push('/');
37
+ }, children: logo }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)("div", { style: { paddingRight: '24px' }, children:
38
+ // 로그인 됨
39
+ user ?
40
+ (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: '16px' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { cursor: 'pointer' }, children: (0, jsx_runtime_1.jsxs)("p", { style: { color: 'white' }, children: [user.id, " \uB2D8"] }) }), (0, jsx_runtime_1.jsx)("div", { style: { cursor: 'pointer' }, onClick: handleLogout, children: (0, jsx_runtime_1.jsx)("p", { style: { color: 'white' }, children: "\uB85C\uADF8\uC544\uC6C3" }) })] })
41
+ :
42
+ // 로그인 안됨
43
+ (0, jsx_runtime_1.jsx)("div", {}) })] }));
44
+ };
45
+ exports.default = Component;
@@ -0,0 +1,5 @@
1
+ export interface Header2Props {
2
+ logo: React.ReactNode;
3
+ }
4
+ declare const Component: ({ logo }: Header2Props) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;