Skip to content

Commit 31e8072

Browse files
committed
spot fixes
1 parent b5d78bb commit 31e8072

File tree

3 files changed

+61
-30
lines changed

3 files changed

+61
-30
lines changed

plugins/app/Layout.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,30 @@ export function App(props: PanelAppProps) {
7676
}
7777

7878
export default function Layout(props: LayoutPanelProps) {
79-
const {
79+
let {
8080
data,
8181
session,
8282
request,
8383
response,
8484
children
8585
} = props;
8686
//unload flash message
87-
useEffect(unload, []);
87+
useEffect(() => {
88+
if (!request) {
89+
request = {} as any;
90+
}
91+
if (request && !request.session) {
92+
request.session = {} as any;
93+
}
94+
if (request?.session && !request.session.theme) {
95+
const dark = document.cookie.includes('theme=dark');
96+
request.session.theme = dark ? 'dark': 'light';
97+
}
98+
unload();
99+
}, []);
100+
if (!request?.session?.theme) {
101+
return null;
102+
}
88103
return (
89104
<LayoutProvider
90105
data={data}

plugins/app/views/home.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,83 +139,83 @@ export default function HomePage(props: ServerPageProps) {
139139
</h4>
140140
<div className="overflow-x-auto">
141141
<Table>
142-
<Thead noWrap className="theme-bg-bg2 theme-info text-right cursor-pointer">
142+
<Thead noWrap className="theme-bg-bg2 theme-info text-right cursor-pointer border-0">
143143
{_('ID')}
144144
<i className="inline-block px-ml-10 fas fa-sort" />
145145
</Thead>
146-
<Thead className="theme-bg-bg2 text-left">
146+
<Thead className="theme-bg-bg2 text-left border-0">
147147
{_('Name')}
148148
</Thead>
149-
<Thead className="theme-bg-bg2 text-center">
149+
<Thead className="theme-bg-bg2 text-center border-0">
150150
{_('Role')}
151151
</Thead>
152-
<Thead className="theme-bg-bg2 text-left">
152+
<Thead className="theme-bg-bg2 text-left border-0">
153153
{_('Tags')}
154154
</Thead>
155-
<Thead className="theme-bg-bg2 text-left">
155+
<Thead className="theme-bg-bg2 text-left border-0">
156156
{_('Country')}
157157
</Thead>
158-
<Thead className="theme-bg-bg2 text-center">
158+
<Thead className="theme-bg-bg2 text-center border-0">
159159
{_('Active')}
160160
</Thead>
161-
<Thead noWrap className="theme-bg-bg2 theme-info text-right cursor-pointer">
161+
<Thead noWrap className="theme-bg-bg2 theme-info text-right cursor-pointer border-0">
162162
{_('Created')}
163163
<i className="inline-block px-ml-10 fas fa-sort" />
164164
</Thead>
165-
<Thead className="theme-bg-bg2" stickyRight>
165+
<Thead className="theme-bg-bg2 px-r--1 border-0" stickyRight>
166166
&nbsp;
167167
</Thead>
168168
<Trow>
169-
<Tcol className="theme-bg-bg0 text-right">
169+
<Tcol className="theme-bg-bg0 text-right border-0">
170170
10431
171171
</Tcol>
172-
<Tcol noWrap className="theme-bg-bg0 text-left">
172+
<Tcol noWrap className="theme-bg-bg0 text-left border-0">
173173
John Doe
174174
</Tcol>
175-
<Tcol className="theme-bg-bg0 theme-info text-center cursor-pointer">
175+
<Tcol className="theme-bg-bg0 theme-info text-center cursor-pointer border-0">
176176
user
177177
</Tcol>
178-
<Tcol className="theme-bg-bg0 theme-info text-left">
179-
<Tags value={[ 'location', 'commerce', 'address' ]} />
178+
<Tcol className="theme-bg-bg0 theme-info text-left border-0">
179+
<Tags className="rounded-full theme-bg-warning" value={[ 'location', 'commerce', 'address' ]} />
180180
</Tcol>
181-
<Tcol noWrap className="theme-bg-bg0 theme-info text-left cursor-pointer">
181+
<Tcol noWrap className="theme-bg-bg0 theme-info text-left cursor-pointer border-0">
182182
United States
183183
</Tcol>
184-
<Tcol className="theme-bg-bg0 theme-info text-center cursor-pointer">
184+
<Tcol className="theme-bg-bg0 theme-info text-center cursor- border-0">
185185
Yes
186186
</Tcol>
187-
<Tcol noWrap className="theme-bg-bg0 text-right">
187+
<Tcol noWrap className="theme-bg-bg0 text-right border-0">
188188
2 days ago
189189
</Tcol>
190-
<Tcol className="theme-bg-bg0" stickyRight>
190+
<Tcol className="theme-bg-bg0 border-0 px-r--1" stickyRight>
191191
<Button info>
192192
<i className="fas fa-fw fa-caret-right"></i>
193193
</Button>
194194
</Tcol>
195195
</Trow>
196196
<Trow>
197-
<Tcol className="theme-bg-bg1 text-right">
197+
<Tcol className="theme-bg-bg1 text-right border-0">
198198
10432
199199
</Tcol>
200-
<Tcol noWrap className="theme-bg-bg1 text-left">
200+
<Tcol noWrap className="theme-bg-bg1 text-left border-0">
201201
Jane Doe
202202
</Tcol>
203-
<Tcol className="theme-bg-bg1 theme-info text-center cursor-pointer">
203+
<Tcol className="theme-bg-bg1 theme-info text-center cursor-pointer border-0">
204204
admin
205205
</Tcol>
206-
<Tcol className="theme-bg-bg1 theme-info text-left">
207-
<Tags value={[ 'location', 'commerce', 'address' ]} />
206+
<Tcol className="theme-bg-bg1 theme-info text-left border-0">
207+
<Tags className="rounded-full theme-bg-warning" value={[ 'location', 'commerce', 'address' ]} />
208208
</Tcol>
209-
<Tcol className="theme-bg-bg1 theme-info text-left cursor-pointer">
209+
<Tcol className="theme-bg-bg1 theme-info text-left cursor-pointer border-0">
210210
Canada
211211
</Tcol>
212-
<Tcol className="theme-bg-bg1 theme-info text-center cursor-pointer">
212+
<Tcol className="theme-bg-bg1 theme-info text-center cursor-pointer border-0">
213213
Yes
214214
</Tcol>
215-
<Tcol noWrap className="theme-bg-bg1 text-right">
215+
<Tcol noWrap className="theme-bg-bg1 text-right border-0">
216216
last week
217217
</Tcol>
218-
<Tcol className="theme-bg-bg1" stickyRight>
218+
<Tcol className="theme-bg-bg1 border-0 px-r--1" stickyRight>
219219
<Button info>
220220
<i className="fas fa-fw fa-caret-right"></i>
221221
</Button>

plugins/docs/components/Layout.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export function LayoutApp(props: {
425425
}
426426

427427
export default function Layout(props: LayoutProviderProps & PanelAppProps) {
428-
const {
428+
let {
429429
data,
430430
session,
431431
request,
@@ -434,7 +434,23 @@ export default function Layout(props: LayoutProviderProps & PanelAppProps) {
434434
children
435435
} = props;
436436
//unload flash message
437-
useEffect(unload, []);
437+
//unload flash message
438+
useEffect(() => {
439+
if (!request) {
440+
request = {} as any;
441+
}
442+
if (request && !request.session) {
443+
request.session = {} as any;
444+
}
445+
if (request?.session && !request.session.theme) {
446+
const dark = document.cookie.includes('theme=dark');
447+
request.session.theme = dark ? 'dark': 'light';
448+
}
449+
unload();
450+
}, []);
451+
if (!request?.session?.theme) {
452+
return null;
453+
}
438454
return (
439455
<LayoutProvider
440456
data={data}

0 commit comments

Comments
 (0)