diff --git a/apps/client/layouts/newLayout.tsx b/apps/client/layouts/newLayout.tsx index 556f1c0a7..a42a27558 100644 --- a/apps/client/layouts/newLayout.tsx +++ b/apps/client/layouts/newLayout.tsx @@ -13,6 +13,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { Fragment, useCallback, useEffect, useState } from "react"; +import { ContextMenu } from "@radix-ui/themes"; import useTranslation from "next-translate/useTranslation"; import { useUser } from "../store/session"; @@ -355,7 +356,7 @@ export default function NewLayout({ children }: any) { {/* Static sidebar for desktop */}
{/* Sidebar component, swap this element with another sidebar if you like */} -
+
{/* Workflow */} @@ -374,8 +375,8 @@ export default function NewLayout({ children }: any) { href={item.href} className={classNames( item.current - ? "bg-[#F0F3F9]" - : " hover:bg-[#F0F3F9]", + ? "bg-[#F0F3F9] dark:bg-gray-800 dark:text-green-600" + : " hover:bg-[#F0F3F9] dark:hover:bg-white dark:hover:text-gray-900 ", "group -mx-2 flex gap-x-3 p-1 text-xs font-semibold leading-6" )} > @@ -398,8 +399,8 @@ export default function NewLayout({ children }: any) { href="/tickets" className={classNames( location.pathname === "/tickets" - ? "bg-[#F0F3F9]" - : " hover:bg-[#F0F3F9]", + ? "bg-[#F0F3F9] dark:bg-gray-800 dark:text-green-600" + : " hover:bg-[#F0F3F9] dark:hover:bg-white dark:hover:text-gray-900 ", "group -mx-2 flex gap-x-3 p-1 text-xs font-semibold leading-6" )} > @@ -417,8 +418,8 @@ export default function NewLayout({ children }: any) { href="/tickets/open" className={classNames( location.pathname === "/tickets/open" - ? "bg-[#F0F3F9]" - : " hover:bg-[#F0F3F9]", + ? "bg-[#F0F3F9] dark:bg-gray-800 dark:text-green-600" + : " hover:bg-[#F0F3F9] dark:hover:bg-white dark:hover:text-gray-900 ", "group -mx-2 flex gap-x-3 p-1 mll-2 text-xs font-semibold leading-6" )} > @@ -436,8 +437,8 @@ export default function NewLayout({ children }: any) { href="/tickets/closed" className={classNames( location.pathname === "/tickets/closed" - ? "bg-[#F0F3F9]" - : " hover:bg-[#F0F3F9]", + ? "bg-[#F0F3F9] dark:bg-gray-800 dark:text-green-600" + : " hover:bg-[#F0F3F9] dark:hover:bg-white dark:hover:text-gray-900 ", "group -mx-2 flex gap-x-3 p-1 text-xs font-semibold leading-6" )} > @@ -456,23 +457,69 @@ export default function NewLayout({ children }: any) { href="/admin" className={classNames( location.pathname.includes("/admin") - ? "bg-[#F0F3F9]" - : "hover:bg-[#F0F3F9]", + ? "bg-[#F0F3F9] dark:bg-gray-800 dark:text-green-600" + : " hover:bg-[#F0F3F9] dark:hover:bg-white dark:hover:text-gray-900 ", "group -mx-2 flex gap-x-3 p-1 text-xs font-semibold leading-6" )} > -
-
+
*/} -
+
{/*
-
{children}
+
+ {children} +
) diff --git a/apps/client/layouts/notebook.js b/apps/client/layouts/notebook.tsx similarity index 62% rename from apps/client/layouts/notebook.js rename to apps/client/layouts/notebook.tsx index a35696924..c0af390d3 100644 --- a/apps/client/layouts/notebook.js +++ b/apps/client/layouts/notebook.tsx @@ -7,13 +7,16 @@ import { useQuery } from "react-query"; import Loader from "react-spinners/ClipLoader"; async function fetchNotebooks(token) { - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/notebooks/all`, { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${token}`, - }, - }); + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/notebooks/all`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + } + ); return res.json(); } @@ -22,14 +25,14 @@ function classNames(...classes) { } export default function NoteBookLayout({ children }) { - const router = useRouter() + const router = useRouter(); const token = getCookie("session"); - const { data, status, error, refetch } = useQuery( - "getUsersNotebooks", - () => fetchNotebooks(token),) + const { data, status, error, refetch } = useQuery("getUsersNotebooks", () => + fetchNotebooks(token) + ); - const [notebooks, setNotebooks] = useState(); + const [notebooks, setNotebooks] = useState(); const [selected, setSelected] = useState(0); useEffect(() => { @@ -49,18 +52,17 @@ export default function NoteBookLayout({ children }) { {status === "success" && (
-
+
-
{notebooks && notebooks.map((item, index) => ( - {item.title} +
+ {item.title} + {/* + {moment(item.updated_at).fromNow()} + */} +
))}
-
{children}
+
{children}
diff --git a/apps/client/pages/_app.tsx b/apps/client/pages/_app.tsx index 15b48ff63..f2e79f368 100644 --- a/apps/client/pages/_app.tsx +++ b/apps/client/pages/_app.tsx @@ -1,4 +1,5 @@ import "@radix-ui/themes/styles.css"; +import { ThemeProvider } from "next-themes"; import "../styles/globals.css"; import { @@ -7,9 +8,7 @@ import { HomeIcon, TicketIcon, } from "@heroicons/react/24/outline"; -import { MantineProvider } from "@mantine/core"; import { Notifications } from "@mantine/notifications"; -import { SpotlightProvider } from "@mantine/spotlight"; import { Theme } from "@radix-ui/themes"; import { useRouter } from "next/router"; import { QueryClient, QueryClientProvider } from "react-query"; @@ -28,8 +27,6 @@ const queryClient = new QueryClient(); function Auth({ children }: any) { const { loading, user } = useUser(); - const router = useRouter(); - React.useEffect(() => { if (loading) return; // Do nothing while loading }, [user, loading]); @@ -101,38 +98,37 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: any) { if (router.pathname.includes("/admin")) { return ( - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + ); } - if (router.pathname === "/notebook/[id]") { + if (router.pathname.includes("/notebook")) { return ( - - + + @@ -143,8 +139,8 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: any) { - - + + ); } @@ -152,12 +148,12 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: any) { if (router.pathname.includes("/settings")) { return ( - - + + @@ -168,8 +164,8 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: any) { - - + + ); } @@ -194,24 +190,18 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: any) { return ( - - - - - - - - - - - - - - + + + + + + + + + + + + ); } diff --git a/apps/client/pages/index.tsx b/apps/client/pages/index.tsx index f3fd6ca33..128c35cc4 100644 --- a/apps/client/pages/index.tsx +++ b/apps/client/pages/index.tsx @@ -1,11 +1,9 @@ -import { CheckCircleIcon } from "@heroicons/react/20/solid"; import Link from "next/link"; import { useEffect, useState } from "react"; import useTranslation from "next-translate/useTranslation"; import { useRouter } from "next/router"; -import ListTodo from "../components/ListTodo"; import { getCookie } from "cookies-next"; import moment from "moment"; @@ -118,60 +116,22 @@ export default function Home() { }, []); return ( -
+
-
-
-
-
- {/* Profile */} -
- - - {user.name[0]} - - -
-
- - {t("hello_good")}{" "} - {hour! < Number(12) - ? t("hello_morning") - : t("hello_afternoon")} - , {user.name}! - -
-
-
{t("account_status")}
-
-
-
-
-
-
-
-
-
- {!loading && ( <>
-
+
{stats.map((item) => (
-
+
{item.name}
-
+
{item.stat}
@@ -505,10 +465,10 @@ export default function Home() { )}
-
+ {/*
{t("reminders")} -
+
*/}
); } diff --git a/apps/client/pages/new.tsx b/apps/client/pages/new.tsx index 6fa4e6f47..0b8c942cf 100644 --- a/apps/client/pages/new.tsx +++ b/apps/client/pages/new.tsx @@ -171,7 +171,7 @@ export default function CreateTicket() { leaveFrom="opacity-100" leaveTo="opacity-0" > - + {options !== undefined && options.map((client: any) => ( createTicket()} - className="rounded bg-indigo-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" + className="rounded bg-green-600 px-4 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600" > Create Ticket diff --git a/apps/client/pages/notebook/[id].js b/apps/client/pages/notebook/[id].tsx similarity index 97% rename from apps/client/pages/notebook/[id].js rename to apps/client/pages/notebook/[id].tsx index d243e0a32..3e805b526 100644 --- a/apps/client/pages/notebook/[id].js +++ b/apps/client/pages/notebook/[id].tsx @@ -76,6 +76,7 @@ export default function Notebooks() { ); setSaving(false); let date = new Date(); + // @ts-ignore setLastSaved(new Date(date).getTime()); } @@ -91,7 +92,7 @@ export default function Notebooks() { return ( <> -
+

{title}

{saving ? ( saving .... @@ -102,7 +103,7 @@ export default function Notebooks() { )}
{!loading && ( - + diff --git a/apps/client/pages/notebook/index.js b/apps/client/pages/notebook/index.js deleted file mode 100644 index a2cbb3383..000000000 --- a/apps/client/pages/notebook/index.js +++ /dev/null @@ -1,131 +0,0 @@ -import { getCookie } from "cookies-next"; -import moment from "moment"; -import useTranslation from "next-translate/useTranslation"; -import { useRouter } from "next/router"; -import { useQuery } from "react-query"; - -async function fetchNotebooks(token) { - const res = await fetch( - `${process.env.NEXT_PUBLIC_API_URL}/api/v1/notebooks/all`, - { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${token}`, - }, - } - ); - return res.json(); -} - -export default function NoteBooksIndex() { - const { t } = useTranslation("peppermint"); - - const token = getCookie("session"); - const { data, status, error, refetch } = useQuery("getUsersNotebooks", () => - fetchNotebooks(token) - ); - - const router = useRouter(); - - async function deleteNotebook(id) { - if (window.confirm("Do you really want to delete this notebook?")) { - const res = await fetch(`/api/v1/note/${id}/delete`).then((res) => - res.json() - ); - console.log(res); - refetch(); - } - } - - return ( - <> -
-
-
-

- {t("notebooks")} -

-

- {t("notebooks_description")} -

-
- -
- {status === "success" && ( -
-
-
- {data.notebooks.length > 0 && ( - - - - - - - - - - - {data.notebooks.map((note) => ( - router.push(`/notebook/${note.id}`)} - > - - - - - - ))} - -
- {t("title")} - - {t("created_at")} - - {t("updated_at")} -
- {note.title} - - {moment(note.createdAt).format("DD-MM-YYYY")} - - {moment(note.updatedAt).format("DD-MM-YYYY")} - - -
- )} -
-
-
- )} -
- - ); -} diff --git a/apps/client/pages/notebook/index.tsx b/apps/client/pages/notebook/index.tsx new file mode 100644 index 000000000..22f8a9719 --- /dev/null +++ b/apps/client/pages/notebook/index.tsx @@ -0,0 +1,56 @@ +import { getCookie } from "cookies-next"; +import useTranslation from "next-translate/useTranslation"; +import { useRouter } from "next/router"; +import { useQuery } from "react-query"; + +async function fetchNotebooks(token) { + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/notebooks/all`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + } + ); + return res.json(); +} + +export default function NoteBooksIndex() { + const { t } = useTranslation("peppermint"); + + const token = getCookie("session"); + const { data, status, error, refetch } = useQuery("getUsersNotebooks", () => + fetchNotebooks(token) + ); + + const router = useRouter(); + + async function deleteNotebook(id) { + if (window.confirm("Do you really want to delete this notebook?")) { + const res = await fetch(`/api/v1/note/${id}/delete`).then((res) => + res.json() + ); + console.log(res); + refetch(); + } + } + + return ( + <> +
+
+
+

+ {t("notebooks")} +

+

+ {t("notebooks_description")} +

+
+
+
+ + ); +} diff --git a/apps/client/pages/notebook/new.js b/apps/client/pages/notebook/new.tsx similarity index 74% rename from apps/client/pages/notebook/new.js rename to apps/client/pages/notebook/new.tsx index bb0b6b70c..803d009bf 100644 --- a/apps/client/pages/notebook/new.js +++ b/apps/client/pages/notebook/new.tsx @@ -13,7 +13,7 @@ import useTranslation from "next-translate/useTranslation"; export default function ViewNoteBook() { const [value, setValue] = useState(""); - const [title, setTitle] = useState("Markdown Test"); + const [title, setTitle] = useState(""); const { t } = useTranslation("peppermint"); @@ -60,29 +60,28 @@ export default function ViewNoteBook() { return (
-
-
-
+
- + @@ -126,16 +125,6 @@ export default function ViewNoteBook() {
- -
- -
);