rdy-dashboard 1.0.5 → 1.0.7

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 (54) hide show
  1. package/dist/AuthContext.tsx +86 -0
  2. package/dist/RoutesContext.tsx +25 -0
  3. package/dist/admin.ui.tsx +28 -0
  4. package/dist/api/api.d.ts +7 -0
  5. package/dist/api/api.esm.js +43 -0
  6. package/dist/api/api.js +49 -0
  7. package/dist/api/auth.api.d.ts +8 -0
  8. package/dist/api/auth.api.esm.js +23 -0
  9. package/dist/api/auth.api.js +25 -0
  10. package/dist/api/headers.api.d.ts +5 -0
  11. package/dist/api/headers.api.esm.js +13 -0
  12. package/dist/api/headers.api.js +15 -0
  13. package/dist/api.ts +53 -0
  14. package/dist/auth.api.ts +21 -0
  15. package/dist/components/input.d.ts +13 -0
  16. package/dist/components/input.esm.js +7 -0
  17. package/dist/components/input.js +9 -0
  18. package/dist/components/protectedRoute.d.ts +3 -0
  19. package/dist/components/protectedRoute.esm.js +25 -0
  20. package/dist/components/protectedRoute.js +27 -0
  21. package/dist/context/AuthContext.d.ts +16 -0
  22. package/dist/context/AuthContext.esm.js +18 -0
  23. package/dist/context/AuthContext.js +20 -0
  24. package/dist/context/RoutesContext.d.ts +12 -0
  25. package/dist/context/RoutesContext.esm.js +18 -0
  26. package/dist/context/RoutesContext.js +21 -0
  27. package/dist/entities/admin/admin.ui.d.ts +7 -0
  28. package/dist/entities/admin/admin.ui.esm.js +15 -0
  29. package/dist/entities/admin/admin.ui.js +17 -0
  30. package/dist/entities/login/login.ui.d.ts +1 -0
  31. package/dist/entities/login/login.ui.esm.js +52 -0
  32. package/dist/entities/login/login.ui.js +54 -0
  33. package/dist/entities/sidebar/sidebar.ui.d.ts +1 -0
  34. package/dist/entities/sidebar/sidebar.ui.esm.js +15 -0
  35. package/dist/entities/sidebar/sidebar.ui.js +17 -0
  36. package/dist/entities/table/table.ui.d.ts +4 -0
  37. package/dist/entities/table/table.ui.esm.js +55 -0
  38. package/dist/entities/table/table.ui.js +57 -0
  39. package/dist/headers.api.ts +11 -0
  40. package/dist/index.d.ts +12 -16
  41. package/dist/index.esm.js +10 -13077
  42. package/dist/index.js +24 -215
  43. package/dist/index.ts +18 -0
  44. package/dist/input.tsx +37 -0
  45. package/dist/login.ui.tsx +127 -0
  46. package/dist/model.ts +14 -0
  47. package/dist/protectedRoute.tsx +23 -0
  48. package/dist/sidebar.ui.tsx +23 -0
  49. package/dist/table.ui.tsx +140 -0
  50. package/dist/templates/dashboard-layout.tsx +11 -0
  51. package/dist/templates/dashboard-page.tsx +5 -0
  52. package/dist/templates/login-page.tsx +7 -0
  53. package/dist/types/model/model.d.ts +12 -0
  54. package/package.json +4 -2
@@ -0,0 +1,86 @@
1
+ 'use client'
2
+
3
+ import { createContext, useContext, useState, useEffect, ReactNode } from 'react';
4
+ import { useRouter, usePathname } from 'next/navigation';
5
+ import api from '../';
6
+ import { getAuthHeaders } from '../';
7
+
8
+ interface AuthContextType {
9
+ user: any | null;
10
+ isLoading: boolean;
11
+ login: (credentials: { email: string; password: string }) => Promise<void>;
12
+ logout: () => Promise<void>;
13
+ checkAuth: () => Promise<void>;
14
+ }
15
+
16
+ const AuthContext = createContext<AuthContextType | undefined>(undefined);
17
+
18
+ export function AuthProvider({ children }: { children: ReactNode }) {
19
+ const [user, setUser] = useState<any | null>(null);
20
+ const [isLoading, setIsLoading] = useState(true);
21
+ const router = useRouter();
22
+ const pathname = usePathname();
23
+
24
+ useEffect(() => {
25
+ checkAuth();
26
+ }, []);
27
+
28
+ useEffect(() => {
29
+ // Автоматическая проверка при изменении маршрута
30
+ if (!isLoading && user && (pathname === '/login' || pathname === '/register')) {
31
+ router.push('/dashboard');
32
+ }
33
+ }, [pathname, user, isLoading, router]);
34
+
35
+ const checkAuth = async () => {
36
+ setIsLoading(true);
37
+ try {
38
+ const response = await api.get('/auth/me', { headers: await getAuthHeaders() });
39
+ setUser(response.data);
40
+ } catch (error) {
41
+ setUser(null);
42
+ // Если на странице логина - не редиректим
43
+ if (pathname !== '/login' && pathname !== '/register') {
44
+ router.push('/login');
45
+ }
46
+ } finally {
47
+ setIsLoading(false);
48
+ }
49
+ };
50
+
51
+ const login = async (credentials: { email: string; password: string }) => {
52
+ try {
53
+ const response = await api.post('/auth/login', credentials);
54
+ setUser(response.data);
55
+ router.push('/dashboard');
56
+ router.refresh();
57
+ } catch (error) {
58
+ throw error;
59
+ }
60
+ };
61
+
62
+ const logout = async () => {
63
+ try {
64
+ await api.post('/auth/logout', { headers: await getAuthHeaders() });
65
+ } catch (error) {
66
+ console.error('Logout error:', error);
67
+ } finally {
68
+ setUser(null);
69
+ router.push('/login');
70
+ }
71
+ };
72
+
73
+ return (
74
+ <AuthContext.Provider value={{ user, isLoading, login, logout, checkAuth }}>
75
+ {children}
76
+ </AuthContext.Provider>
77
+ );
78
+ }
79
+
80
+ export const useAuth = () => {
81
+ const context = useContext(AuthContext);
82
+ if (context === undefined) {
83
+ throw new Error('useAuth must be used within an AuthProvider');
84
+ }
85
+ return context;
86
+ };
@@ -0,0 +1,25 @@
1
+ // routes.tsx
2
+ import { createContext, useContext, ReactNode } from "react";
3
+
4
+ // ====== 1. Роуты ======
5
+ export type Route = {
6
+ route: {
7
+ name: string;
8
+ url: string;
9
+ }
10
+ };
11
+
12
+ // ====== 2. Контекст ======
13
+ const RoutesContext = createContext<Route[] | null>(null);
14
+
15
+ // ====== 3. Провайдер ======
16
+ export const RoutesProvider = ({ children, routes }: { children: ReactNode, routes: Route[] }) => {
17
+ return <RoutesContext.Provider value={routes}>{children}</RoutesContext.Provider>;
18
+ };
19
+
20
+ // ====== 4. Хук для использования ======
21
+ export const useRoutesConfig = (): Route[] => {
22
+ const context = useContext(RoutesContext);
23
+ if (!context) throw new Error("useRoutesConfig must be used inside RoutesProvider");
24
+ return context;
25
+ };
@@ -0,0 +1,28 @@
1
+ "use client"
2
+
3
+ import { Route, RoutesProvider } from "../../context/RoutesContext";
4
+ import { Sidebar } from "../..";
5
+ import ProtectedRoute from "../../components/protectedRoute";
6
+
7
+ interface Props {
8
+ routes: Route[];
9
+ children: React.ReactNode;
10
+ }
11
+
12
+ export const AdminUi: React.FC<Props> = ({ routes, children }) => {
13
+ return (
14
+ <ProtectedRoute>
15
+ <div className="">
16
+ <RoutesProvider
17
+ routes={routes}>
18
+ <div className="">
19
+ <Sidebar />
20
+ <div className="">
21
+ {children}
22
+ </div>
23
+ </div>
24
+ </RoutesProvider>
25
+ </div>
26
+ </ProtectedRoute>
27
+ )
28
+ }
@@ -0,0 +1,7 @@
1
+ export declare const BACKEND_URL: string;
2
+ export declare const ACCESS_TOKEN: string;
3
+ export declare const BACKEND_HEADERS: {
4
+ 'Content-Type': string;
5
+ };
6
+ declare const api: import("axios").AxiosInstance;
7
+ export default api;
@@ -0,0 +1,43 @@
1
+ import axios from 'axios';
2
+
3
+ const BACKEND_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:9000/api";
4
+ process.env.JWT_ACCESS_TOKEN || "";
5
+ const BACKEND_HEADERS = { 'Content-Type': 'application/json' };
6
+ const api = axios.create({
7
+ baseURL: BACKEND_URL,
8
+ headers: BACKEND_HEADERS,
9
+ withCredentials: true,
10
+ });
11
+ let refreshPromise = null;
12
+ api.interceptors.response.use((response) => response, async (error) => {
13
+ if (!error.response) {
14
+ return Promise.reject(error);
15
+ }
16
+ const originalRequest = error.config;
17
+ if (error.response.status === 401 && !originalRequest._retry) {
18
+ originalRequest._retry = true;
19
+ if (!refreshPromise) {
20
+ refreshPromise = (async () => {
21
+ try {
22
+ await api.post('/auth/refresh');
23
+ }
24
+ finally {
25
+ refreshPromise = null;
26
+ }
27
+ })();
28
+ }
29
+ try {
30
+ await refreshPromise;
31
+ return api(originalRequest);
32
+ }
33
+ catch (refreshError) {
34
+ if (typeof window !== 'undefined') {
35
+ localStorage.removeItem('access_token');
36
+ }
37
+ return Promise.reject(refreshError);
38
+ }
39
+ }
40
+ return Promise.reject(error);
41
+ });
42
+
43
+ export { BACKEND_HEADERS, BACKEND_URL, api as default };
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var axios = require('axios');
6
+
7
+ const BACKEND_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:9000/api";
8
+ process.env.JWT_ACCESS_TOKEN || "";
9
+ const BACKEND_HEADERS = { 'Content-Type': 'application/json' };
10
+ const api = axios.create({
11
+ baseURL: BACKEND_URL,
12
+ headers: BACKEND_HEADERS,
13
+ withCredentials: true,
14
+ });
15
+ let refreshPromise = null;
16
+ api.interceptors.response.use((response) => response, async (error) => {
17
+ if (!error.response) {
18
+ return Promise.reject(error);
19
+ }
20
+ const originalRequest = error.config;
21
+ if (error.response.status === 401 && !originalRequest._retry) {
22
+ originalRequest._retry = true;
23
+ if (!refreshPromise) {
24
+ refreshPromise = (async () => {
25
+ try {
26
+ await api.post('/auth/refresh');
27
+ }
28
+ finally {
29
+ refreshPromise = null;
30
+ }
31
+ })();
32
+ }
33
+ try {
34
+ await refreshPromise;
35
+ return api(originalRequest);
36
+ }
37
+ catch (refreshError) {
38
+ if (typeof window !== 'undefined') {
39
+ localStorage.removeItem('access_token');
40
+ }
41
+ return Promise.reject(refreshError);
42
+ }
43
+ }
44
+ return Promise.reject(error);
45
+ });
46
+
47
+ exports.BACKEND_HEADERS = BACKEND_HEADERS;
48
+ exports.BACKEND_URL = BACKEND_URL;
49
+ exports.default = api;
@@ -0,0 +1,8 @@
1
+ export declare const authApi: {
2
+ login: (credentials: {
3
+ email: string;
4
+ password: string;
5
+ }) => Promise<any>;
6
+ logout: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
7
+ me: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
8
+ };
@@ -0,0 +1,23 @@
1
+ import api from './api.esm.js';
2
+ import { getAuthHeaders } from './headers.api.esm.js';
3
+
4
+ const authApi = {
5
+ login: async (credentials) => {
6
+ try {
7
+ const response = await api.post('/auth/login', credentials);
8
+ return response.data;
9
+ }
10
+ catch (error) {
11
+ console.error('API Error:', error.response?.data || error.message);
12
+ throw error;
13
+ }
14
+ },
15
+ logout: async () => api.post("/auth/logout", {
16
+ headers: await getAuthHeaders(),
17
+ }),
18
+ me: async () => api.get("/auth/me", {
19
+ headers: await getAuthHeaders(),
20
+ }),
21
+ };
22
+
23
+ export { authApi };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var api = require('./api.js');
4
+ var headers_api = require('./headers.api.js');
5
+
6
+ const authApi = {
7
+ login: async (credentials) => {
8
+ try {
9
+ const response = await api.default.post('/auth/login', credentials);
10
+ return response.data;
11
+ }
12
+ catch (error) {
13
+ console.error('API Error:', error.response?.data || error.message);
14
+ throw error;
15
+ }
16
+ },
17
+ logout: async () => api.default.post("/auth/logout", {
18
+ headers: await headers_api.getAuthHeaders(),
19
+ }),
20
+ me: async () => api.default.get("/auth/me", {
21
+ headers: await headers_api.getAuthHeaders(),
22
+ }),
23
+ };
24
+
25
+ exports.authApi = authApi;
@@ -0,0 +1,5 @@
1
+ export declare const getAuthHeaders: () => Promise<{
2
+ Cookie: string;
3
+ } | {
4
+ Cookie?: undefined;
5
+ }>;
@@ -0,0 +1,13 @@
1
+ const getAuthHeaders = async () => {
2
+ try {
3
+ const { cookies } = await import('next/headers');
4
+ const cookieStore = await cookies();
5
+ const accessToken = cookieStore.get('accessToken')?.value;
6
+ return accessToken ? { Cookie: `accessToken=${accessToken}` } : {};
7
+ }
8
+ catch (err) {
9
+ return {};
10
+ }
11
+ };
12
+
13
+ export { getAuthHeaders };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const getAuthHeaders = async () => {
4
+ try {
5
+ const { cookies } = await import('next/headers');
6
+ const cookieStore = await cookies();
7
+ const accessToken = cookieStore.get('accessToken')?.value;
8
+ return accessToken ? { Cookie: `accessToken=${accessToken}` } : {};
9
+ }
10
+ catch (err) {
11
+ return {};
12
+ }
13
+ };
14
+
15
+ exports.getAuthHeaders = getAuthHeaders;
package/dist/api.ts ADDED
@@ -0,0 +1,53 @@
1
+ import axios from "axios";
2
+
3
+ export const BACKEND_URL: string = process.env.NEXT_PUBLIC_API_URL || "http://localhost:9000/api";
4
+ export const ACCESS_TOKEN: string = process.env.JWT_ACCESS_TOKEN || "";
5
+
6
+ export const BACKEND_HEADERS = { 'Content-Type': 'application/json' };
7
+
8
+ const api = axios.create({
9
+ baseURL: BACKEND_URL,
10
+ headers: BACKEND_HEADERS,
11
+ withCredentials: true,
12
+ });
13
+
14
+ let refreshPromise: Promise<void> | null = null;
15
+
16
+ api.interceptors.response.use(
17
+ (response) => response,
18
+ async (error) => {
19
+ if (!error.response) {
20
+ return Promise.reject(error);
21
+ }
22
+
23
+ const originalRequest = error.config;
24
+
25
+ if (error.response.status === 401 && !originalRequest._retry) {
26
+ originalRequest._retry = true;
27
+
28
+ if (!refreshPromise) {
29
+ refreshPromise = (async () => {
30
+ try {
31
+ await api.post('/auth/refresh');
32
+ } finally {
33
+ refreshPromise = null;
34
+ }
35
+ })();
36
+ }
37
+
38
+ try {
39
+ await refreshPromise;
40
+ return api(originalRequest);
41
+ } catch (refreshError) {
42
+ if (typeof window !== 'undefined') {
43
+ localStorage.removeItem('access_token');
44
+ }
45
+ return Promise.reject(refreshError);
46
+ }
47
+ }
48
+
49
+ return Promise.reject(error);
50
+ }
51
+ );
52
+
53
+ export default api;
@@ -0,0 +1,21 @@
1
+ import api from "./api"
2
+ import { getAuthHeaders } from "./headers.api";
3
+
4
+ export const authApi = {
5
+ login: async (credentials: { email: string; password: string }) => {
6
+ try {
7
+ const response = await api.post('/auth/login', credentials);
8
+ return response.data;
9
+ } catch (error: any) {
10
+ console.error('API Error:', error.response?.data || error.message);
11
+ throw error;
12
+ }
13
+ },
14
+ logout: async () => api.post("/auth/logout", {
15
+ headers: await getAuthHeaders(),
16
+ }),
17
+
18
+ me: async () => api.get("/auth/me", {
19
+ headers: await getAuthHeaders(),
20
+ }),
21
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface InputProps {
3
+ type?: string;
4
+ name: string;
5
+ placeholder?: string;
6
+ value: string;
7
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
+ required?: boolean;
9
+ disabled?: boolean;
10
+ className?: string;
11
+ }
12
+ export declare const Input: React.FC<InputProps>;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ const Input = ({ type = 'text', name, placeholder, value, onChange, required = false, disabled = false, className = '', }) => {
4
+ return (jsx("input", { type: type, name: name, placeholder: placeholder, value: value, onChange: onChange, required: required, disabled: disabled, className: `${className}` }));
5
+ };
6
+
7
+ export { Input };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const Input = ({ type = 'text', name, placeholder, value, onChange, required = false, disabled = false, className = '', }) => {
6
+ return (jsxRuntime.jsx("input", { type: type, name: name, placeholder: placeholder, value: value, onChange: onChange, required: required, disabled: disabled, className: `${className}` }));
7
+ };
8
+
9
+ exports.Input = Input;
@@ -0,0 +1,3 @@
1
+ export default function ProtectedRoute({ children }: {
2
+ children: React.ReactNode;
3
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { useEffect } from 'react';
4
+ import { useRouter } from 'next/navigation';
5
+ import '../api/api.esm.js';
6
+ import '../context/RoutesContext.esm.js';
7
+ import 'next/link';
8
+ import { useAuth } from '../context/AuthContext.esm.js';
9
+
10
+ // components/ProtectedRoute.tsx
11
+ function ProtectedRoute({ children }) {
12
+ const { user, isLoading } = useAuth();
13
+ const router = useRouter();
14
+ useEffect(() => {
15
+ if (!isLoading && !user) {
16
+ router.push('/login');
17
+ }
18
+ }, [user, isLoading, router]);
19
+ if (isLoading) {
20
+ return jsx("div", { children: "Loading..." });
21
+ }
22
+ return user ? jsx(Fragment, { children: children }) : null;
23
+ }
24
+
25
+ export { ProtectedRoute as default };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var navigation = require('next/navigation');
7
+ require('../api/api.js');
8
+ require('../context/RoutesContext.js');
9
+ require('next/link');
10
+ var AuthContext = require('../context/AuthContext.js');
11
+
12
+ // components/ProtectedRoute.tsx
13
+ function ProtectedRoute({ children }) {
14
+ const { user, isLoading } = AuthContext.useAuth();
15
+ const router = navigation.useRouter();
16
+ react.useEffect(() => {
17
+ if (!isLoading && !user) {
18
+ router.push('/login');
19
+ }
20
+ }, [user, isLoading, router]);
21
+ if (isLoading) {
22
+ return jsxRuntime.jsx("div", { children: "Loading..." });
23
+ }
24
+ return user ? jsxRuntime.jsx(jsxRuntime.Fragment, { children: children }) : null;
25
+ }
26
+
27
+ module.exports = ProtectedRoute;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ interface AuthContextType {
3
+ user: any | null;
4
+ isLoading: boolean;
5
+ login: (credentials: {
6
+ email: string;
7
+ password: string;
8
+ }) => Promise<void>;
9
+ logout: () => Promise<void>;
10
+ checkAuth: () => Promise<void>;
11
+ }
12
+ export declare function AuthProvider({ children }: {
13
+ children: ReactNode;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export declare const useAuth: () => AuthContextType;
16
+ export {};
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import 'react/jsx-runtime';
3
+ import { createContext, useContext } from 'react';
4
+ import 'next/navigation';
5
+ import '../api/api.esm.js';
6
+ import './RoutesContext.esm.js';
7
+ import 'next/link';
8
+
9
+ const AuthContext = createContext(undefined);
10
+ const useAuth = () => {
11
+ const context = useContext(AuthContext);
12
+ if (context === undefined) {
13
+ throw new Error('useAuth must be used within an AuthProvider');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { useAuth };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ require('react/jsx-runtime');
5
+ var react = require('react');
6
+ require('next/navigation');
7
+ require('../api/api.js');
8
+ require('./RoutesContext.js');
9
+ require('next/link');
10
+
11
+ const AuthContext = react.createContext(undefined);
12
+ const useAuth = () => {
13
+ const context = react.useContext(AuthContext);
14
+ if (context === undefined) {
15
+ throw new Error('useAuth must be used within an AuthProvider');
16
+ }
17
+ return context;
18
+ };
19
+
20
+ exports.useAuth = useAuth;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from "react";
2
+ export type Route = {
3
+ route: {
4
+ name: string;
5
+ url: string;
6
+ };
7
+ };
8
+ export declare const RoutesProvider: ({ children, routes }: {
9
+ children: ReactNode;
10
+ routes: Route[];
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const useRoutesConfig: () => Route[];
@@ -0,0 +1,18 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext } from 'react';
3
+
4
+ // ====== 2. Контекст ======
5
+ const RoutesContext = createContext(null);
6
+ // ====== 3. Провайдер ======
7
+ const RoutesProvider = ({ children, routes }) => {
8
+ return jsx(RoutesContext.Provider, { value: routes, children: children });
9
+ };
10
+ // ====== 4. Хук для использования ======
11
+ const useRoutesConfig = () => {
12
+ const context = useContext(RoutesContext);
13
+ if (!context)
14
+ throw new Error("useRoutesConfig must be used inside RoutesProvider");
15
+ return context;
16
+ };
17
+
18
+ export { RoutesProvider, useRoutesConfig };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+
6
+ // ====== 2. Контекст ======
7
+ const RoutesContext = react.createContext(null);
8
+ // ====== 3. Провайдер ======
9
+ const RoutesProvider = ({ children, routes }) => {
10
+ return jsxRuntime.jsx(RoutesContext.Provider, { value: routes, children: children });
11
+ };
12
+ // ====== 4. Хук для использования ======
13
+ const useRoutesConfig = () => {
14
+ const context = react.useContext(RoutesContext);
15
+ if (!context)
16
+ throw new Error("useRoutesConfig must be used inside RoutesProvider");
17
+ return context;
18
+ };
19
+
20
+ exports.RoutesProvider = RoutesProvider;
21
+ exports.useRoutesConfig = useRoutesConfig;
@@ -0,0 +1,7 @@
1
+ import { Route } from "../../context/RoutesContext";
2
+ interface Props {
3
+ routes: Route[];
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const AdminUi: React.FC<Props>;
7
+ export {};
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { RoutesProvider } from '../../context/RoutesContext.esm.js';
4
+ import '../../api/api.esm.js';
5
+ import ProtectedRoute from '../../components/protectedRoute.esm.js';
6
+ import 'next/navigation';
7
+ import 'react';
8
+ import { SidebarUi } from '../sidebar/sidebar.ui.esm.js';
9
+ import '../../context/AuthContext.esm.js';
10
+
11
+ const AdminUi = ({ routes, children }) => {
12
+ return (jsx(ProtectedRoute, { children: jsx("div", { className: "", children: jsx(RoutesProvider, { routes: routes, children: jsxs("div", { className: "", children: [jsx(SidebarUi, {}), jsx("div", { className: "", children: children })] }) }) }) }));
13
+ };
14
+
15
+ export { AdminUi };
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var RoutesContext = require('../../context/RoutesContext.js');
6
+ require('../../api/api.js');
7
+ var protectedRoute = require('../../components/protectedRoute.js');
8
+ require('next/navigation');
9
+ require('react');
10
+ var sidebar_ui = require('../sidebar/sidebar.ui.js');
11
+ require('../../context/AuthContext.js');
12
+
13
+ const AdminUi = ({ routes, children }) => {
14
+ return (jsxRuntime.jsx(protectedRoute, { children: jsxRuntime.jsx("div", { className: "", children: jsxRuntime.jsx(RoutesContext.RoutesProvider, { routes: routes, children: jsxRuntime.jsxs("div", { className: "", children: [jsxRuntime.jsx(sidebar_ui.SidebarUi, {}), jsxRuntime.jsx("div", { className: "", children: children })] }) }) }) }));
15
+ };
16
+
17
+ exports.AdminUi = AdminUi;