Skip to content
Merged

Dev #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed favicon.jpg
Binary file not shown.
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/jpg" href="/favicon.jpg" />
<link rel="icon" type="image/jpg" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web app for storing notes and todos" />
Expand Down
Binary file added src/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/logo-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 36 additions & 4 deletions src/components/molecules/modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const openDeleteModal = (id: string, deleteFn) => {
});
};

export function openDetailsModal(data?: TodoWithId & NoteWithId) {
modals.open({
export function openDetailsModal(data?: TodoWithId | NoteWithId, type: 'note' | 'todo') {
const modalId = modals.open({
title: (
<Text fw={700} size="lg">
Details:
Expand All @@ -45,15 +45,47 @@ export function openDetailsModal(data?: TodoWithId & NoteWithId) {
children: (
<>
<Text ta="center" size="xl">
{data?.extraContent}
{data?.content}
</Text>
<Divider my="md" />
<Flex justify={'flex-end'}>
<Button onClick={() => openTodoModal(data)} variant="light" fz={'md'}>
<Button
onClick={() => {
modals.close(modalId);
type === 'todo' ? openTodoModal(data) : openNoteModal(data);
}}
variant="light"
fz={'md'}
>
Edit
</Button>
</Flex>
</>
)
});
console.log('🚀 ~ modalId:', modalId);
}

// export function openNoteDetailsModal(data?: NoteWithId) {
// modals.open({
// title: (
// <Text fw={700} size="lg">
// Details:
// </Text>
// ),
// centered: true,
// children: (
// <>
// <Text ta="center" size="xl">
// {data?.content}
// </Text>
// <Divider my="md" />
// <Flex justify={'flex-end'}>
// <Button onClick={() => openNoteModal(data)} variant="light" fz={'md'}>
// Edit
// </Button>
// </Flex>
// </>
// )
// });
// }
4 changes: 2 additions & 2 deletions src/components/organizms/forms/todo-management-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const TodoManagementForm = ({ data }: { data?: TodoWithId }) => {
? removeId<TodoWithId>(data)
: {
title: '',
extraContent: '',
content: '',
deadline: null,
completed: false,
createdOn: Timestamp.now()
Expand Down Expand Up @@ -99,7 +99,7 @@ export const TodoManagementForm = ({ data }: { data?: TodoWithId }) => {
}}
/>
<Field
name="extraContent"
name="content"
validators={{
onSubmit: z.string().optional(),
onChange: z
Expand Down
5 changes: 3 additions & 2 deletions src/components/organizms/nav-bar/nav-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { NavBarButtonWrapper, NavBarUser } from '@notes/components';
import classes from './styles.module.css';
import { Box } from '@mantine/core';
import { Box, Image } from '@mantine/core';
import logo from '../../../assets/logo.svg';

export const NavBar = () => {
return (
<Box className={classes.wrapper}>
<Box className={classes.logo}>XXX_LOGO_XXX</Box>
<Box className={classes.logo}><Image w="200px" src={logo} /></Box>
<Box className={classes.bar}>
<NavBarButtonWrapper />
<NavBarUser />
Expand Down
20 changes: 10 additions & 10 deletions src/context/auth-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ export function AuthProvider({ children }) {
const [user, setUser] = useState<User | null>(getAuth().currentUser);
const [rememberMe, setRememberMe] = useState(false);
const [loading, setLoading] = useState(true);

function setLoadingState(loading: boolean) {
setLoading(loading);
}
async function signIn(email: string, password: string) {
if (!rememberMe) {
try {
try {
if (!rememberMe) {
await setPersistence(auth, inMemoryPersistence);
return signInWithEmailAndPassword(auth, email, password);
} catch (error) {
if (error instanceof Error) {
throw new Error(error.message);
} else {
throw new Error('An unknown error occurred');
}
}
} else {

return signInWithEmailAndPassword(auth, email, password);
} catch (error) {
if (error instanceof Error) {
throw new Error(error.message);
} else {
throw new Error('An unknown error occurred');
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type NoteWithId = Note & { id: string }
export type Todo = {
title: string;
createdOn: Timestamp;
extraContent: string;
content: string;
completed: boolean;
deadline: Timestamp | null;
};
Expand Down
7 changes: 6 additions & 1 deletion src/views/home/login.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import classes from './styles.module.css';
import { Box, Button, Flex, Space, Title } from '@mantine/core';
import { Box, Button, Flex, Space, Title,Image } from '@mantine/core';
import { Link } from '@tanstack/react-router';
import { RoutesDef } from '@notes/utils';
import logo from '../../assets/logo.svg';

export const AuthView = () => (
<Box className={classes.wrapper}>
<Flex justify={'center'} w="500px" m="0 auto" mt="xl" >
<Image w="100%" src={logo} />
</Flex>
<Title order={2} c="var(--white)" mt="4rem">

The best app for todos an taking notes.
</Title>
<Space h="xl" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/pages/notes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const Notes = () => {
tooltipMessage: 'Delete this note'
},
Details: {
onClick: openDetailsModal,
onClick: data => openDetailsModal(data, 'note'),
icon: <IconBubbleText />,
color: 'var(--primary)',
tooltipMessage: 'See more details'
Expand Down
8 changes: 4 additions & 4 deletions src/views/pages/todos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import {
useReactTable
} from '@tanstack/react-table';
import { CollectionType, ControlConfig, Todo, TodoWithId } from '@notes/types';
import { Box, Checkbox, Flex, Title } from '@mantine/core';
import { Checkbox, Flex, Title } from '@mantine/core';
import { IconBubbleText, IconEdit, IconTrash } from '@tabler/icons-react';
import classes from './styles.module.css';
import { getTableControls } from '@notes/utils';

export const Todos = () => {
Expand Down Expand Up @@ -50,7 +49,7 @@ export const Todos = () => {
tooltipMessage: 'Delete this note'
},
Details: {
onClick: openDetailsModal,
onClick: data => openDetailsModal(data, 'todo'),
icon: <IconBubbleText />,
color: 'var(--primary)',
tooltipMessage: 'See more details'
Expand All @@ -74,7 +73,7 @@ export const Todos = () => {
return <span>{props.row.original.createdOn.toDate().toLocaleString()}</span>;
}
}),
columnHelper.accessor('extraContent', {
columnHelper.accessor('content', {
header: 'Extra Content'
}),
columnHelper.accessor('deadline', {
Expand Down Expand Up @@ -132,3 +131,4 @@ export const Todos = () => {
</MainLayout>
);
};
// uzyć useInView z useInfiniteQuery z kursu