Skip to content

Commit

Permalink
Merge pull request #8 from recallwei/v1.1.4
Browse files Browse the repository at this point in the history
Release v1.1.4
  • Loading branch information
recallwei committed Oct 1, 2022
2 parents 5aea383 + d37d663 commit 4346842
Show file tree
Hide file tree
Showing 29 changed files with 592 additions and 484 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## v1.1

## v1.1.4

- A brand new UI for the task checkbox.
- Add sync state icon.
- Refactor react-router.
- Fix the redirect error when getting status code 400 and 401.

## v1.1.3

- Update the icon of the start button.
Expand Down
2 changes: 1 addition & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
- [ ] Theme preference
- [ ] Language preference
- [ ] Custom background image
- [ ] Auto sync/refresh
- [x] Sync state icon
- [ ] More App
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Taskward is a Todo&Task application.
- React
- TypeScript
- Vite
- Tailwind

## Library

- Tailwind
- DaisyUI
- React-Redux
- React-Query
- React-Hook-Form & yup
Expand Down
2 changes: 2 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module "@tailwindcss/typography";
declare module "daisyui";
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-theme="taskward">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="/src/css/index.css" />
Expand Down
61 changes: 35 additions & 26 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Suspense } from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import {
Route,
RouterProvider,
createBrowserRouter,
createRoutesFromElements
} from "react-router-dom";
import { useTranslation } from "react-i18next";
import clsx from "clsx";
import { Authentication, Layout, Loading, Notification } from "@components";
Expand All @@ -11,43 +16,47 @@ import {
NotFound,
Login,
Signup,
Icons,
Icons
} from "@pages";

export default function App(): JSX.Element {
const { i18n } = useTranslation();

const router = createBrowserRouter(
createRoutesFromElements(
<>
<Route index element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route
path="/"
element={
<Authentication>
<Layout />
<Notification />
</Authentication>
}
>
<Route path="note" element={<Note />} />
<Route path="archive" element={<Archive />} />
<Route path="trash" element={<Trash />} />
</Route>
<Route path="/icons" element={<Icons />} />
<Route path="*" element={<NotFound />} />
</>
)
);

return (
<div
className={clsx(
"text-black transition-[background-color] dark:bg-darkMode-darker dark:text-white",
i18n.language
)}
>
<BrowserRouter>
<Suspense fallback={<Loading fullScreen />}>
<Routes>
<Route index element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route
path="/"
element={
<Authentication>
<Layout />
<Notification />
</Authentication>
}
>
<Route path="note" element={<Note />} />
<Route path="archive" element={<Archive />} />
<Route path="trash" element={<Trash />} />
</Route>
<Route path="/icons" element={<Icons />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Suspense>
</BrowserRouter>
<Suspense fallback={<Loading fullScreen />}>
<RouterProvider router={router} />
</Suspense>
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/Header/LanguageButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Icon } from "@components";
import { LanguageType } from "@i18n";
import { Language } from "@constants";

export default function LanguageIcon() {
export default function LanguageIcon(): JSX.Element {
const { t, i18n } = useTranslation();

const [showDropdown, setShowDropdown] = useState<boolean>(false);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/MenuIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useAppDispatch } from "@hooks";
import { sidebarAction } from "@store";
import { Icon } from "@components";

export default function MenuIcon() {
export default function MenuIcon(): JSX.Element {
const { t } = useTranslation(["layout"]);
const sidebarDispatch = useAppDispatch();

Expand Down
16 changes: 16 additions & 0 deletions src/components/Header/SyncIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Icon } from "@components";
import { useAppSelector } from "@hooks";

export default function SyncIcon(): JSX.Element | null {
const isLoading = useAppSelector((state) => state.request.isLoading);

if (!isLoading) {
return null;
}

return (
<div className="select-none rounded-full p-2 transition-colors">
<Icon.Sync />
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/Header/ThemeModeButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Icon } from "@components";
import { useAppSelector, useAppDispatch } from "@hooks";
import { styleAction, ThemeMode } from "@store";

export default function ThemeModeButton() {
export default function ThemeModeButton(): JSX.Element {
const { t } = useTranslation(["layout"]);
const styleDispatch = useAppDispatch();

Expand Down
2 changes: 2 additions & 0 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import LanguageIcon from "./LanguageButton";
import ThemeModeButton from "./ThemeModeButton";
import MenuIcon from "./MenuIcon";
import UserAvatar from "./UserAvatar";
import SyncIcon from "./SyncIcon";

export default function Header(): JSX.Element {
const { t } = useTranslation(["layout"]);
Expand Down Expand Up @@ -39,6 +40,7 @@ export default function Header(): JSX.Element {
<div className="ml-2">{getActiveSidebarItemTitle()}</div>
</div>
<div className="mr-2 flex items-center justify-end gap-2">
<SyncIcon />
<LanguageIcon />
<ThemeModeButton />
<UserAvatar />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Input({
register = {},
rightIcon,
error,
errorMessage,
errorMessage
}: InputProps): JSX.Element {
return (
<div className={className}>
Expand Down
24 changes: 12 additions & 12 deletions src/components/NoteCreator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Button, Icon, TaskCheckbox } from "@components";
import type {
CustomComponentProps,
CreateNoteFormData,
TaskFormData,
TaskFormData
} from "@interfaces";
import { useDetectOutsideClick } from "@hooks";
import { useCreateNoteRequest } from "@requests";
Expand All @@ -19,7 +19,7 @@ import { useTaskListDataManager } from "@hooks";

export default function NoteCreator({
style,
className,
className
}: CustomComponentProps): JSX.Element {
const { t } = useTranslation(["common", "note"]);

Expand All @@ -33,7 +33,7 @@ export default function NoteCreator({
removeCreatedTask,
changeChecked,
changeContent,
changeLinkUrl,
changeLinkUrl
} = useTaskListDataManager();

const outsideClickRef = useDetectOutsideClick({
Expand All @@ -43,31 +43,31 @@ export default function NoteCreator({
insideClickCallback: () => {
setEditable(true);
setTasksData(getValues("tasks") ?? []);
},
}
});

const { handleSubmit, getValues, setValue, reset } =
useForm<CreateNoteFormData>({
defaultValues: {
name: null,
description: null,
tasks: [],
},
tasks: []
}
});

const handleCreateNote = async (formData: CreateNoteFormData) => {
createNote(formData, {
onSuccess: () => {
setEditable(false);
reset();
},
}
});
};

return (
<div
className={clsx(
"mx-auto shrink-0 rounded-lg border border-gray-200 bg-white p-4 ring-0 drop-shadow-lg dark:border-neutral-800 dark:bg-noteDark",
"mx-auto shrink-0 rounded-lg border border-gray-200 bg-white p-4 ring-0 drop-shadow-lg dark:border-slate-800 dark:bg-noteDark",
className
)}
style={style}
Expand All @@ -88,7 +88,7 @@ export default function NoteCreator({
contentEditable
onInput={(e) => {
setValue("name", e.currentTarget.textContent as string, {
shouldValidate: true,
shouldValidate: true
});
}}
dangerouslySetInnerHTML={{ __html: getValues("name") ?? "" }}
Expand All @@ -102,11 +102,11 @@ export default function NoteCreator({
contentEditable
onInput={(e) => {
setValue("description", e.currentTarget.textContent as string, {
shouldValidate: true,
shouldValidate: true
});
}}
dangerouslySetInnerHTML={{
__html: getValues("description") ?? "",
__html: getValues("description") ?? ""
}}
/>
{tasksData && tasksData.length > 0 && (
Expand Down Expand Up @@ -168,7 +168,7 @@ export default function NoteCreator({
id: generateGUID(),
content: null,
linkUrl: null,
finished: false,
finished: false
});
setValue("tasks", result);
setTasksData(result);
Expand Down

1 comment on commit 4346842

@vercel
Copy link

@vercel vercel bot commented on 4346842 Oct 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.