Skip to content

Commit

Permalink
refactor(app): dashboard style improvements and main page if authenti…
Browse files Browse the repository at this point in the history
…cated
  • Loading branch information
riccardoperra committed Aug 22, 2022
1 parent 0e2fd98 commit 25b716a
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 20 deletions.
18 changes: 16 additions & 2 deletions apps/codeimage/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {enableUmami} from '@core/constants/umami';
import {OverlayProvider} from '@solid-aria/overlays';
import {setElementVars} from '@vanilla-extract/dynamic';
import {Router, useRoutes} from 'solid-app-router';
import {createEffect, lazy, on, onMount, Suspense} from 'solid-js';
import {createEffect, lazy, on, onMount, Show, Suspense} from 'solid-js';
import {render} from 'solid-js/web';
import './assets/styles/app.scss';
import {SidebarPopoverHost} from './components/PropertyEditor/SidebarPopoverHost';
Expand All @@ -33,6 +33,8 @@ const Dashboard = lazy(() =>
}),
);

const Editor = lazy(() => import('./pages/Editor/Editor'));

export function Bootstrap() {
getRootEditorStore();
const [, {locale}] = useI18n();
Expand All @@ -41,11 +43,23 @@ export function Bootstrap() {

const Routes = useRoutes([
{
path: ':snippetId?',
path: '',
component: () => {
const state = getAuth0State();
return (
<Show fallback={() => <Editor />} when={state.loggedIn()}>
<Dashboard />
</Show>
);
},
},
{
path: ':snippetId',
component: lazy(() => import('./pages/Editor/Editor')),
},
{
path: 'dashboard',
data: ({navigate}) => navigate('/'),
component: Dashboard,
},
]);
Expand Down
2 changes: 1 addition & 1 deletion apps/codeimage/src/pages/Dashboard/Dashboard.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const scaffold = style([
adaptiveFullScreenHeight,
{
color: themeVars.dynamicColors.panel.textColor,
background: themeVars.dynamicColors.background,
background: themeVars.dynamicColors.panel.background,
display: 'flex',
flexDirection: 'column',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {themeVars} from '@codeimage/ui';
import {style} from '@vanilla-extract/css';
import {toolbarVars} from '../../../../components/Toolbar/Toolbar.css';
import * as toolbarStyles from '../../../../components/Toolbar/Toolbar.css';

export const header = style([
toolbarStyles.toolbarTheme,
{
padding: `0px ${themeVars.spacing['3']}`,
display: 'flex',
height: toolbarVars.toolbarHeight,
background: themeVars.dynamicColors.background,
},
]);

export const headerContent = style({
width: '100%',
margin: 'auto',
display: 'flex',
'@media': {
[`(min-width: 1280px)`]: {
width: '1280px',
},
},
});
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
import {Box, HStack} from '@codeimage/ui';
import {CodeImageLogo} from '../../../../components/Icons/CodeImageLogo';
import {sidebarLogo} from '../../../../components/Scaffold/Sidebar/Sidebar.css';
import {actionBox, wrapper} from '../../../../components/Toolbar/Toolbar.css';
import {actionBox} from '../../../../components/Toolbar/Toolbar.css';
import {ToolbarSettingsButton} from '../../../../components/Toolbar/ToolbarSettings';
import {UserBadge} from '../../../../components/UserBadge/UserBadge';
import * as styles from './DashboardHeader.css';

export function DashboardHeader() {
return (
<div class={wrapper}>
<ToolbarSettingsButton />
<div class={styles.header}>
<div class={styles.headerContent}>
<ToolbarSettingsButton />

<Box display={'flex'} alignItems={'center'} flexGrow={1} marginLeft={5}>
<div class={sidebarLogo}>
<CodeImageLogo width={'140px'} />
</div>
</Box>
<Box display={'flex'} alignItems={'center'} flexGrow={1} marginLeft={5}>
<div class={sidebarLogo}>
<CodeImageLogo width={'140px'} />
</div>
</Box>

<Box class={actionBox} style={{flex: 1}}>
<HStack spacing={'2'} marginLeft={'auto'}>
<UserBadge />
</HStack>
</Box>
<Box class={actionBox} style={{flex: 1}}>
<HStack spacing={'2'} marginLeft={'auto'}>
<UserBadge />
</HStack>
</Box>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {themeVars} from '@codeimage/ui';
import {style} from '@vanilla-extract/css';
import {darkGrayScale} from '../../../../theme/dark-theme.css';

export const item = style({
backgroundColor: themeVars.dynamicColors.input.backgroundColor,
Expand All @@ -8,15 +9,14 @@ export const item = style({
padding: '24px',
paddingBottom: '12px',
height: '128px',
// boxShadow: themeVars.dynamicColors.dialog.panelShadow,
boxShadow: 'inset 0 1px 0 0 rgb(255 255 255 / 5%)',
boxShadow: themeVars.boxShadow.md,
color: themeVars.dynamicColors.baseText,
transition: 'background-color 0.2s ease-in-out',
position: 'relative',
display: 'inline-flex',
flexDirection: 'column',
':hover': {
backgroundColor: themeVars.dynamicColors.listBox.hoverBackgroundColor,
backgroundColor: darkGrayScale.gray2,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const gridListItemCount = createVar();

export const gridList = style({
vars: {
[gridListItemCount]: '3',
[gridListItemCount]: '2',
},
display: 'grid',
gap: themeVars.spacing['3'],
Expand Down

0 comments on commit 25b716a

Please sign in to comment.