Skip to content

Commit e89dbca

Browse files
authored
Dev (#17)
* refactor: Separate atom inputs into separate files for input and textarea * add loading state outside AuthContext * chore: Update loading overlay props in App.tsx and main-layout.tsx * fix color theme in css - removed dark and light for now * add 100% width and footer * chore: Update form wrapper class name in sign-in and sign-up views * add checkbox with remember me text to sign in (no logit yet) * add session persistent to log in * feat: Add email verification during sign up * chore: Refactor form styles and separate atom inputs into separate files * feat: Add button to open todo modal in details modal * chore: Update onClick parameter name in ControlConfig * feat: Update openDetailsModal to accept type parameter * chore: Update favicon file extension to PNG feat: Add logo to login and navigation bar chore: Refactor navbar logo to use Image component
1 parent 83fbef3 commit e89dbca

File tree

14 files changed

+66
-26
lines changed

14 files changed

+66
-26
lines changed

favicon.jpg

-595 KB
Binary file not shown.

favicon.png

510 Bytes
Loading

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" type="image/jpg" href="/favicon.jpg" />
5+
<link rel="icon" type="image/jpg" href="/favicon.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
88
<meta name="description" content="Web app for storing notes and todos" />

src/assets/favicon.png

510 Bytes
Loading

src/assets/logo-color.svg

Lines changed: 1 addition & 0 deletions
Loading

src/assets/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/molecules/modals.tsx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export const openDeleteModal = (id: string, deleteFn) => {
3434
});
3535
};
3636

37-
export function openDetailsModal(data?: TodoWithId & NoteWithId) {
38-
modals.open({
37+
export function openDetailsModal(data?: TodoWithId | NoteWithId, type: 'note' | 'todo') {
38+
const modalId = modals.open({
3939
title: (
4040
<Text fw={700} size="lg">
4141
Details:
@@ -45,15 +45,47 @@ export function openDetailsModal(data?: TodoWithId & NoteWithId) {
4545
children: (
4646
<>
4747
<Text ta="center" size="xl">
48-
{data?.extraContent}
48+
{data?.content}
4949
</Text>
5050
<Divider my="md" />
5151
<Flex justify={'flex-end'}>
52-
<Button onClick={() => openTodoModal(data)} variant="light" fz={'md'}>
52+
<Button
53+
onClick={() => {
54+
modals.close(modalId);
55+
type === 'todo' ? openTodoModal(data) : openNoteModal(data);
56+
}}
57+
variant="light"
58+
fz={'md'}
59+
>
5360
Edit
5461
</Button>
5562
</Flex>
5663
</>
5764
)
5865
});
66+
console.log('🚀 ~ modalId:', modalId);
5967
}
68+
69+
// export function openNoteDetailsModal(data?: NoteWithId) {
70+
// modals.open({
71+
// title: (
72+
// <Text fw={700} size="lg">
73+
// Details:
74+
// </Text>
75+
// ),
76+
// centered: true,
77+
// children: (
78+
// <>
79+
// <Text ta="center" size="xl">
80+
// {data?.content}
81+
// </Text>
82+
// <Divider my="md" />
83+
// <Flex justify={'flex-end'}>
84+
// <Button onClick={() => openNoteModal(data)} variant="light" fz={'md'}>
85+
// Edit
86+
// </Button>
87+
// </Flex>
88+
// </>
89+
// )
90+
// });
91+
// }

src/components/organizms/forms/todo-management-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const TodoManagementForm = ({ data }: { data?: TodoWithId }) => {
1616
? removeId<TodoWithId>(data)
1717
: {
1818
title: '',
19-
extraContent: '',
19+
content: '',
2020
deadline: null,
2121
completed: false,
2222
createdOn: Timestamp.now()
@@ -99,7 +99,7 @@ export const TodoManagementForm = ({ data }: { data?: TodoWithId }) => {
9999
}}
100100
/>
101101
<Field
102-
name="extraContent"
102+
name="content"
103103
validators={{
104104
onSubmit: z.string().optional(),
105105
onChange: z

src/components/organizms/nav-bar/nav-bar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { NavBarButtonWrapper, NavBarUser } from '@notes/components';
22
import classes from './styles.module.css';
3-
import { Box } from '@mantine/core';
3+
import { Box, Image } from '@mantine/core';
4+
import logo from '../../../assets/logo.svg';
45

56
export const NavBar = () => {
67
return (
78
<Box className={classes.wrapper}>
8-
<Box className={classes.logo}>XXX_LOGO_XXX</Box>
9+
<Box className={classes.logo}><Image w="200px" src={logo} /></Box>
910
<Box className={classes.bar}>
1011
<NavBarButtonWrapper />
1112
<NavBarUser />

src/context/auth-context.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ export function AuthProvider({ children }) {
2323
const [user, setUser] = useState<User | null>(getAuth().currentUser);
2424
const [rememberMe, setRememberMe] = useState(false);
2525
const [loading, setLoading] = useState(true);
26+
2627
function setLoadingState(loading: boolean) {
2728
setLoading(loading);
2829
}
2930
async function signIn(email: string, password: string) {
30-
if (!rememberMe) {
31-
try {
31+
try {
32+
if (!rememberMe) {
3233
await setPersistence(auth, inMemoryPersistence);
33-
return signInWithEmailAndPassword(auth, email, password);
34-
} catch (error) {
35-
if (error instanceof Error) {
36-
throw new Error(error.message);
37-
} else {
38-
throw new Error('An unknown error occurred');
39-
}
4034
}
41-
} else {
35+
4236
return signInWithEmailAndPassword(auth, email, password);
37+
} catch (error) {
38+
if (error instanceof Error) {
39+
throw new Error(error.message);
40+
} else {
41+
throw new Error('An unknown error occurred');
42+
}
4343
}
4444
}
4545

0 commit comments

Comments
 (0)