Skip to content

Commit

Permalink
wip: update soon splash styling
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Oct 21, 2024
1 parent 83011c9 commit 0d9b75f
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 51 deletions.
8 changes: 2 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LayoutGroup, LazyMotion, domMax, MotionConfig } from 'framer-motion';
import { BackgroundImage, DashboardContainer } from './theme/styles';
import { DashboardContainer } from './theme/styles';
import { SideBar } from './containers/SideBar';
import { Dashboard } from './containers/Dashboard';

Expand Down Expand Up @@ -27,15 +27,14 @@ export default function App() {
const isShuttingDown = useShuttingDown();
const showSplash = useUIStore((s) => s.showSplash);
const view = useUIStore((s) => s.view);
const visualMode = useUIStore((s) => s.visualMode);

const shutDownMarkup = useMemo(() => {
return isShuttingDown ? <ShuttingDownScreen /> : null;
}, [isShuttingDown]);
const mainMarkup = useMemo(() => {
if (!isShuttingDown && !showSplash) {
return (
<DashboardContainer>
<DashboardContainer $view={view}>
<SideBar />
<Dashboard status={view} />
</DashboardContainer>
Expand Down Expand Up @@ -63,9 +62,6 @@ export default function App() {
<SettingsModal />
<LayoutGroup id="app-content">
{shutDownMarkup}
{!visualMode || view !== 'mining' ? (
<BackgroundImage layout transition={{ duration: 0.3 }} />
) : null}
{mainMarkup}
<ErrorSnackbar />
<SplashScreen />
Expand Down
25 changes: 8 additions & 17 deletions src/components/elements/LinearProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,25 @@ import styled from 'styled-components';

const Wrapper = styled.div`
width: 100%;
background: ${({ theme }) => theme.palette.background.paper};
height: 8px;
background: ${({ theme }) => theme.palette.base};
height: 20px;
border-radius: 20px;
overflow: hidden;
align-items: center;
display: flex;
padding: 5px;
`;

const Bar = styled(m.div)<{ $isSecondary?: boolean }>`
const Bar = styled(m.div)`
border-radius: 20px;
background: ${({ theme, $isSecondary }) => ($isSecondary ? theme.palette.contrast : theme.palette.success.main)};
height: 8px;
background: ${({ theme }) => theme.palette.contrast};
height: 10px;
`;

export function LinearProgress({
value = 10,
variant = 'primary',
}: {
value?: number;
variant?: 'primary' | 'secondary';
}) {
export function LinearProgress({ value = 10 }: { value?: number }) {
return (
<Wrapper>
<Bar
initial={{ width: 0 }}
animate={{ width: `${value}%` }}
$isSecondary={Boolean(variant == 'secondary')}
/>
<Bar initial={{ width: 0 }} animate={{ width: `${value}%` }} />
</Wrapper>
);
}
11 changes: 6 additions & 5 deletions src/containers/Airdrop/AirdropPermission/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const Position = styled('div')`
pointer-events: none;
position: absolute;
bottom: 20px;
bottom: 0;
left: 50%;
z-index: 2;
transform: translateX(-50%);
Expand All @@ -23,10 +23,11 @@ export const BoxWrapper = styled('div')`
padding: 20px;
border-radius: 10px;
background-color: ${({ theme }) => theme.palette.background.accent};
background-color: ${({ theme }) =>
theme.mode === 'dark' ? theme.colorsAlpha.lightAlpha[5] : theme.colorsAlpha.lightAlpha[80]};
box-shadow:
0 10px 25px -12.5px rgba(0, 0, 0, 0.07),
0 12.5px 33.33px -16.66px rgba(0, 0, 0, 0.05),
0 13px 33px -16.66px rgba(0, 0, 0, 0.05),
0 15px 50px -25px rgba(0, 0, 0, 0.035);
pointer-events: all;
Expand All @@ -44,14 +45,14 @@ export const TextWrapper = styled('div')`
`;

export const Title = styled('div')`
color: #000;
color: ${({ theme }) => theme.palette.text.primary};
font-size: 14px;
font-weight: 600;
line-height: 110%;
`;

export const Text = styled('span')`
color: #797979;
color: ${({ theme }) => theme.palette.text.secondary};
font-size: 12px;
font-weight: 500;
line-height: 116.667%;
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AutoUpdateDialog/UpdatedStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function UpdatedStatus({ contentLength, downloaded }: UpdatedStatusProps)
return (
<Stack alignItems="center">
<ProgressWrapper>
<LinearProgress value={(downloaded / contentLength) * 100} variant="secondary" />
<LinearProgress value={(downloaded / contentLength) * 100} />
</ProgressWrapper>
{shouldShowProgress && (
<Typography variant="p">{`${formatSize(downloaded)} / ${formatSize(contentLength)}`}</Typography>
Expand Down
6 changes: 2 additions & 4 deletions src/containers/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import TribesView from './TribesView/TribesView';
import SetupViewContainer from './SetupView/SetupViewContainer';
import { DashboardContainer } from './styles';

function Dashboard({ status }: { status: viewType }) {
export default function Dashboard({ status }: { status: viewType }) {
const viewMarkup =
status == 'setup' ? <SetupViewContainer /> : status == 'tribes' ? <TribesView /> : <MiningView />;
return <DashboardContainer layout>{viewMarkup}</DashboardContainer>;
}

export default Dashboard;
}

Check failure on line 11 in src/containers/Dashboard/Dashboard.tsx

View workflow job for this annotation

GitHub Actions / Run linters

Insert `⏎`
2 changes: 1 addition & 1 deletion src/containers/Dashboard/SetupView/SetupView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function SetupView({
</SetupDescription>

<ProgressWrapper>
<LinearProgress value={progressPercentage} variant="secondary" />
<LinearProgress value={progressPercentage} />
</ProgressWrapper>
<SetupPercentage>{`${progressPercentage}%`}</SetupPercentage>
<SetupDescription>{title ? t(`title.${title}`, titleParams) : ''}</SetupDescription>
Expand Down
1 change: 1 addition & 0 deletions src/containers/Dashboard/SetupView/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export const Wrapper = styled('div')`
export const SoonWrapper = styled.div`
max-width: 260px;
height: auto;
filter: ${({ theme }) => (theme.mode === 'dark' ? 'brightness(0.9)' : 'none')};
`;
2 changes: 1 addition & 1 deletion src/containers/Dashboard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const DashboardContainer = styled(m.div)`
`;

export const ProgressWrapper = styled.div`
margin: 30px 0 20px 0;
margin: 20px 0;
display: flex;
width: 100%;
`;
Expand Down
1 change: 1 addition & 0 deletions src/theme/palettes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const darkPalette: ThemePalette = {
paper: c.grey[700],
accent: c.grey[400],
main: c.grey[800],
splash: '#2E2E2E',
},
success: {
main: c.green[600],
Expand Down
1 change: 1 addition & 0 deletions src/theme/palettes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const lightPalette: ThemePalette = {
main: c.grey[50],
paper: '#fff',
accent: c.grey[100],
splash: '#e5e5e5',
},
success: {
main: c.success[300],
Expand Down
20 changes: 4 additions & 16 deletions src/theme/styles.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
import styled from 'styled-components';
import { m } from 'framer-motion';
import clouds from '@app/assets/backgrounds/clouds.png';

import { viewType } from '@app/store/types.ts';

export const sidebarWidth = '348px'; // if this is updated please update the value in init-visuals.js

export const DashboardContainer = styled(m.div)`
export const DashboardContainer = styled(m.div)<{ $view?: viewType }>`
display: grid;
grid-template-columns: ${sidebarWidth} auto;
position: relative;
gap: 20px;
padding: 20px;
height: 100%;
filter: ${({ theme }) => (theme.mode === 'dark' ? 'brightness(0.85)' : 'none')};
`;

export const BackgroundImage = styled(m.div)`
background-color: ${(props) => props.theme.palette.background.main};
background-size: cover;
pointer-events: none;
background-image: url(${clouds});
background-position: center;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: ${(props) => (props.$view !== 'setup' ? 'none' : props.theme.palette.background.splash)};
`;
1 change: 1 addition & 0 deletions src/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface Palette {
divider: string;
background: {
default: string;
splash: string;
paper: string;
accent: string;
main: string;
Expand Down

0 comments on commit 0d9b75f

Please sign in to comment.