1+ "use client"
2+
3+ import React from "react" ;
4+ import {
5+ Badge ,
6+ Button ,
7+ Card ,
8+ DLayout ,
9+ Flex ,
10+ InputLabel ,
11+ Spacing ,
12+ SwitchInput ,
13+ Text ,
14+ useService ,
15+ useStore ,
16+ useUserSession
17+ } from "@code0-tech/pictor" ;
18+ import { UserService } from "@edition/user/User.service" ;
19+ import { notFound } from "next/navigation" ;
20+ import { Tab , TabContent , TabList , TabTrigger } from "@code0-tech/pictor/dist/components/tab/Tab" ;
21+ import { IconGavel , IconSettings } from "@tabler/icons-react" ;
22+ import CardSection from "@code0-tech/pictor/dist/components/card/CardSection" ;
23+ import process from "node:process" ;
24+
25+ export const ApplicationSettingsPage : React . FC = ( ) => {
26+ const currentSession = useUserSession ( )
27+ const userStore = useStore ( UserService )
28+ const userService = useService ( UserService )
29+ const currentUser = React . useMemo ( ( ) => userService . getById ( currentSession ?. user ?. id ) , [ userStore , currentSession ] )
30+
31+ if ( currentUser && ! currentUser . admin ) {
32+ return notFound ( )
33+ }
34+
35+ return < >
36+ < Spacing spacing = { "xl" } />
37+ < Tab orientation = { "vertical" } defaultValue = { "general" } >
38+ < DLayout leftContent = {
39+ < TabList >
40+ < InputLabel > Application</ InputLabel >
41+ < TabTrigger value = { "general" } >
42+ < Button paddingSize = { "xxs" } variant = { "none" } >
43+ < IconSettings size = { 16 } />
44+ < Text size = { "md" } hierarchy = { "primary" } > General</ Text >
45+ </ Button >
46+ </ TabTrigger >
47+ < TabTrigger value = { "restrictions" } >
48+ < Button paddingSize = { "xxs" } variant = { "none" } >
49+ < IconGavel size = { 16 } />
50+ < Text size = { "md" } hierarchy = { "primary" } > Restrictions</ Text >
51+ </ Button >
52+ </ TabTrigger >
53+ </ TabList >
54+ } >
55+ < >
56+ < TabContent value = { "general" } >
57+ < Text size = { "xl" } hierarchy = { "primary" } > General</ Text >
58+ < Spacing spacing = { "xl" } />
59+ < div style = { { borderBottom : "1px solid rgba(255,255,255,.1)" } } />
60+ < Spacing spacing = { "xl" } />
61+ < Card p = { 1.3 } >
62+ < CardSection border >
63+ < Flex justify = { "space-between" } align = { "center" } >
64+ < Flex style = { { gap : ".35rem" , flexDirection : "column" } } >
65+ < Text size = { "md" } hierarchy = { "primary" } > Sculptor version</ Text >
66+ < Text size = { "md" } hierarchy = { "tertiary" } > Version of this application</ Text >
67+ </ Flex >
68+ < Badge color = { "info" } > v0.0.0-mvp.1</ Badge >
69+ </ Flex >
70+ </ CardSection >
71+
72+ < CardSection border >
73+ < Flex justify = { "space-between" } align = { "center" } >
74+ < Flex style = { { gap : ".35rem" , flexDirection : "column" } } >
75+ < Text size = { "md" } hierarchy = { "primary" } > Pictor version</ Text >
76+ < Text size = { "md" } hierarchy = { "tertiary" } > Version of the UI component
77+ library</ Text >
78+ </ Flex >
79+ < Badge
80+ color = { "info" } > { process . env . NEXT_PUBLIC_pictorVersion ?? "v0.0.0-mvp.10" } </ Badge >
81+ </ Flex >
82+ </ CardSection >
83+ < CardSection border >
84+ < Flex justify = { "space-between" } align = { "center" } >
85+ < Flex style = { { gap : ".35rem" , flexDirection : "column" } } >
86+ < Text size = { "md" } hierarchy = { "primary" } > Sagittarius version</ Text >
87+ < Text size = { "md" } hierarchy = { "tertiary" } > Version of the backend</ Text >
88+ </ Flex >
89+ < Badge color = { "info" } > 2134929721-ee</ Badge >
90+ </ Flex >
91+ </ CardSection >
92+ </ Card >
93+ </ TabContent >
94+ < TabContent value = { "restrictions" } >
95+ < Text size = { "xl" } hierarchy = { "primary" } > Restrictions</ Text >
96+ < Spacing spacing = { "xl" } />
97+ < div style = { { borderBottom : "1px solid rgba(255,255,255,.1)" } } />
98+ < Spacing spacing = { "xl" } />
99+ < Flex style = { { gap : "1.3rem" , flexDirection : "column" } } >
100+ < Card p = { 1.3 } >
101+ < Flex justify = { "space-between" } align = { "center" } >
102+ < Flex style = { { gap : ".35rem" , flexDirection : "column" } } >
103+ < Text size = { "md" } hierarchy = { "primary" } > Organization creation</ Text >
104+ < Text size = { "md" } hierarchy = { "tertiary" } > Set if organization creation is
105+ restricted
106+ to
107+ administrators.</ Text >
108+ </ Flex >
109+ < SwitchInput w = { "40px" } />
110+ </ Flex >
111+ </ Card >
112+ < Spacing spacing = { "xxs" } />
113+ < Text size = { "xl" } hierarchy = { "primary" } > Danger Zone</ Text >
114+ < div style = { { borderBottom : "1px solid rgba(255,255,255,.1)" } } />
115+ < Card color = { "error" } p = { 1.3 } >
116+ < Flex justify = { "space-between" } align = { "center" } >
117+ < Flex style = { { gap : ".35rem" , flexDirection : "column" } } >
118+ < Text size = { "md" } hierarchy = { "primary" } > User registration</ Text >
119+ < Text size = { "md" } hierarchy = { "tertiary" } > Set if user registration is
120+ enabled.</ Text >
121+ </ Flex >
122+ < SwitchInput w = { "40px" } />
123+ </ Flex >
124+ </ Card >
125+ </ Flex >
126+
127+ </ TabContent >
128+ </ >
129+ </ DLayout >
130+ </ Tab >
131+ </ >
132+ }
0 commit comments