Skip to content

Commit 420b699

Browse files
authored
update UI for initial onboarding screen (#109)
1 parent 86394b4 commit 420b699

File tree

8 files changed

+258
-237
lines changed

8 files changed

+258
-237
lines changed

messages/renderer/en.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,14 @@
8989
"screens.DeviceNamingScreen.title": {
9090
"message": "Name Your Device"
9191
},
92+
"screens.IntroToCoMapeo.appDescription": {
93+
"message": "View and manage observations collected with CoMapeo Mobile."
94+
},
9295
"screens.IntroToCoMapeo.collaborate": {
93-
"message": "Collaborate with others"
96+
"message": "Collaborate on projects"
97+
},
98+
"screens.IntroToCoMapeo.comapeoDesktop": {
99+
"message": "<b><orange>Co</orange>Mapeo</b> <blue>Desktop</blue>"
94100
},
95101
"screens.IntroToCoMapeo.designedFor": {
96102
"message": "Designed with and for Indigenous peoples & frontline communities"
@@ -104,9 +110,6 @@
104110
"screens.IntroToCoMapeo.ownData": {
105111
"message": "Own and control your data"
106112
},
107-
"screens.IntroToCoMapeo.viewAndManage": {
108-
"message": "View and manage observations in CoMapeo Mobile Projects."
109-
},
110113
"screens.JoinProjectScreen.declineInvite": {
111114
"message": "Decline Invite"
112115
},

src/main/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ function setupIpc({ intl }) {
180180
*/
181181
function initMainWindow({ appMode, services }) {
182182
const mainWindow = new BrowserWindow({
183-
height: 600,
184-
width: 800,
183+
width: 1200,
184+
minWidth: 800,
185+
height: 800,
186+
minHeight: 500,
185187
show: false,
186188
backgroundColor: '#050F77',
187189
webPreferences: { preload: MAIN_WINDOW_PRELOAD_PATH },

src/renderer/src/App.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { StrictMode } from 'react'
12
import { ClientApiProvider } from '@comapeo/core-react'
23
import { CssBaseline, ThemeProvider } from '@mui/material'
34
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
@@ -28,21 +29,25 @@ declare module '@tanstack/react-router' {
2829
}
2930
}
3031

31-
const PersistedProjectIdStore = createActiveProjectIdStore({
32+
const persistedProjectIdStore = createActiveProjectIdStore({
3233
persist: true,
3334
})
3435

35-
export const App = () => (
36-
<ThemeProvider theme={theme}>
37-
<CssBaseline />
38-
<IntlProvider>
39-
<QueryClientProvider client={queryClient}>
40-
<ClientApiProvider clientApi={clientApi}>
41-
<ActiveProjectIdProvider store={PersistedProjectIdStore}>
42-
<RouterProvider router={router} />
43-
</ActiveProjectIdProvider>
44-
</ClientApiProvider>
45-
</QueryClientProvider>
46-
</IntlProvider>
47-
</ThemeProvider>
48-
)
36+
export function App() {
37+
return (
38+
<StrictMode>
39+
<ThemeProvider theme={theme}>
40+
<CssBaseline />
41+
<IntlProvider>
42+
<QueryClientProvider client={queryClient}>
43+
<ClientApiProvider clientApi={clientApi}>
44+
<ActiveProjectIdProvider store={persistedProjectIdStore}>
45+
<RouterProvider router={router} />
46+
</ActiveProjectIdProvider>
47+
</ClientApiProvider>
48+
</QueryClientProvider>
49+
</IntlProvider>
50+
</ThemeProvider>
51+
</StrictMode>
52+
)
53+
}

src/renderer/src/Theme.ts

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createTheme } from '@mui/material/styles'
1+
import { createTheme, responsiveFontSizes } from '@mui/material/styles'
22

33
import {
44
ALMOST_BLACK,
@@ -20,10 +20,35 @@ declare module '@mui/material/Button' {
2020
}
2121
}
2222

23-
const theme = createTheme({
23+
declare module '@mui/material/styles' {
24+
interface TypographyVariants {
25+
bannerTitle: React.CSSProperties
26+
bannerSubtitle: React.CSSProperties
27+
}
28+
29+
interface TypographyVariantsOptions {
30+
bannerTitle?: React.CSSProperties
31+
bannerSubtitle?: React.CSSProperties
32+
}
33+
34+
interface TypeText {
35+
inverted: string
36+
}
37+
}
38+
39+
declare module '@mui/material/Typography' {
40+
interface TypographyPropsVariantOverrides {
41+
bannerTitle: true
42+
bannerSubtitle: true
43+
}
44+
}
45+
46+
const baseTheme = createTheme({
47+
spacing: 4,
2448
typography: {
25-
fontFamily: 'Rubik, sans-serif',
26-
fontSize: 12,
49+
fontFamily: `'Rubik Variable', sans-serif`,
50+
fontWeightBold: 500,
51+
fontSize: 16,
2752
body1: {
2853
fontSize: '1rem',
2954
},
@@ -38,7 +63,6 @@ const theme = createTheme({
3863
},
3964
button: {
4065
fontSize: '1rem',
41-
fontWeight: 700,
4266
textTransform: 'none',
4367
},
4468
caption: {
@@ -52,11 +76,21 @@ const theme = createTheme({
5276
fontSize: '1.5rem',
5377
fontWeight: 600,
5478
},
79+
bannerTitle: {
80+
fontSize: '6rem',
81+
lineHeight: 1,
82+
},
83+
bannerSubtitle: {
84+
fontSize: '1.5rem',
85+
fontWeight: 500,
86+
lineHeight: 1.25,
87+
},
5588
},
5689
palette: {
5790
text: {
5891
primary: ALMOST_BLACK,
5992
secondary: DARK_GREY,
93+
inverted: WHITE,
6094
},
6195
primary: {
6296
main: COMAPEO_BLUE,
@@ -95,7 +129,7 @@ const theme = createTheme({
95129
variant: 'contained',
96130
},
97131
styleOverrides: {
98-
root: ({ ownerState }) => ({
132+
root: ({ ownerState, theme }) => ({
99133
...(ownerState.variant === 'outlined' && {
100134
borderColor: '#CCCCD6',
101135
borderWidth: 1,
@@ -106,16 +140,30 @@ const theme = createTheme({
106140
borderWidth: 1,
107141
},
108142
}),
109-
borderRadius: 32,
110-
textTransform: 'none',
111-
fontSize: '1rem',
112-
fontWeight: 400,
113-
paddingVertical: 12,
143+
borderRadius: theme.spacing(8),
114144
}),
115145
},
116146
},
117147
},
118-
spacing: 1,
148+
})
149+
150+
const theme = responsiveFontSizes(baseTheme, {
151+
breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],
152+
variants: [
153+
'bannerSubtitle',
154+
'bannerTitle',
155+
'body1',
156+
'body2',
157+
'button',
158+
'caption',
159+
'h1',
160+
'h2',
161+
'h3',
162+
'h4',
163+
'h5',
164+
'subtitle1',
165+
'subtitle2',
166+
],
119167
})
120168

121169
export { theme }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Based on
3+
* https://tanstack.com/router/latest/docs/framework/react/guide/custom-link#button
4+
*/
5+
import MUIButton, { type ButtonProps } from '@mui/material/Button'
6+
import { createLink } from '@tanstack/react-router'
7+
8+
export const ButtonLink = createLink((props: ButtonProps<'a'>) => {
9+
return <MUIButton component="a" ref={props.ref} {...props} />
10+
})

src/renderer/src/contexts/IntlContext.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@ import {
33
use,
44
useCallback,
55
useState,
6+
type ComponentProps,
67
type PropsWithChildren,
78
} from 'react'
89
import { IntlProvider as ReactIntlProvider } from 'react-intl'
910

1011
import en from '../../../../translations/renderer/en.json'
12+
import { CORNFLOWER_BLUE, ORANGE } from '../colors'
13+
14+
const RICH_TEXT_MAPPINGS: ComponentProps<
15+
typeof ReactIntlProvider
16+
>['defaultRichTextElements'] = {
17+
b: (parts) => {
18+
return <b>{parts}</b>
19+
},
20+
orange: (parts) => {
21+
return <span style={{ color: ORANGE }}>{parts}</span>
22+
},
23+
blue: (parts) => {
24+
return <span style={{ color: CORNFLOWER_BLUE }}>{parts}</span>
25+
},
26+
}
1127

1228
const messages = { en }
1329

@@ -28,6 +44,7 @@ export function IntlProvider({ children }: PropsWithChildren) {
2844
messages={messages[locale]}
2945
locale={locale}
3046
defaultLocale="en"
47+
defaultRichTextElements={RICH_TEXT_MAPPINGS}
3148
>
3249
<LocaleContext value={updateLocale}>{children}</LocaleContext>
3350
</ReactIntlProvider>

src/renderer/src/index.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
html,
2-
body,
3-
#app {
1+
@import '@fontsource-variable/rubik';
2+
3+
html {
44
font-family:
55
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
66
sans-serif;
7-
margin: auto;
8-
height: 100%;
9-
margin: 0;
10-
padding: 0;
7+
}
8+
9+
body {
10+
min-height: 100vh;
1111
}

0 commit comments

Comments
 (0)