chore: add dashboard navbar (#1560)

This commit is contained in:
Aaryan Khandelwal 2023-07-19 12:16:39 +05:30 committed by GitHub
parent a7aa78a349
commit ccab382d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 26 deletions

View File

@ -35,7 +35,7 @@ export const ProductUpdatesModal: React.FC<Props> = ({ isOpen, setIsOpen }) => {
</Transition.Child> </Transition.Child>
<div className="fixed inset-0 z-20 overflow-y-auto"> <div className="fixed inset-0 z-20 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> <div className="grid place-items-center min-h-full text-center p-4">
<Transition.Child <Transition.Child
as={React.Fragment} as={React.Fragment}
enter="ease-out duration-300" enter="ease-out duration-300"
@ -45,8 +45,8 @@ export const ProductUpdatesModal: React.FC<Props> = ({ isOpen, setIsOpen }) => {
leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
> >
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-custom-background-80 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-custom-background-100 border border-custom-border-100 text-left shadow-xl transition-all grid place-items-center sm:w-full sm:max-w-2xl">
<div className="max-h-[600px] overflow-y-auto bg-custom-background-80 p-5"> <div className="max-h-[90vh] overflow-y-auto p-5">
<div className="sm:flex sm:items-start"> <div className="sm:flex sm:items-start">
<div className="flex w-full flex-col gap-y-4 text-center sm:text-left"> <div className="flex w-full flex-col gap-y-4 text-center sm:text-left">
<Dialog.Title <Dialog.Title

View File

@ -2,9 +2,12 @@ import React, { useEffect, useState } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
import useSWR, { mutate } from "swr"; import useSWR, { mutate } from "swr";
// next-themes
import { useTheme } from "next-themes";
// layouts // layouts
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout"; import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
// services // services
@ -21,9 +24,11 @@ import {
} from "components/workspace"; } from "components/workspace";
import { TourRoot } from "components/onboarding"; import { TourRoot } from "components/onboarding";
// ui // ui
import { PrimaryButton, ProductUpdatesModal } from "components/ui"; import { Icon, PrimaryButton, ProductUpdatesModal } from "components/ui";
// images // images
import emptyDashboard from "public/empty-state/dashboard.svg"; import emptyDashboard from "public/empty-state/dashboard.svg";
import githubBlackImage from "/public/logos/github-black.png";
import githubWhiteImage from "/public/logos/github-white.png";
// helpers // helpers
import { render12HourFormatTime, renderShortDate } from "helpers/date-time.helper"; import { render12HourFormatTime, renderShortDate } from "helpers/date-time.helper";
// types // types
@ -41,6 +46,8 @@ const WorkspacePage: NextPage = () => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug } = router.query; const { workspaceSlug } = router.query;
const { theme } = useTheme();
const { user } = useUser(); const { user } = useUser();
const { projects } = useProjects(); const { projects } = useProjects();
@ -60,7 +67,36 @@ const WorkspacePage: NextPage = () => {
}, [month, workspaceSlug]); }, [month, workspaceSlug]);
return ( return (
<WorkspaceAuthorizationLayout noHeader> <WorkspaceAuthorizationLayout
left={
<div className="flex items-center gap-2 px-3">
<Icon iconName="grid_view" />
Dashboard
</div>
}
right={
<div className="flex items-center gap-3">
<button
onClick={() => setIsProductUpdatesModalOpen(true)}
className="flex items-center gap-1.5 bg-custom-background-80 text-xs font-medium py-1.5 px-3 rounded"
>
<Icon iconName="bolt" className="!text-base -my-1" />
What{"'"}s New?
</button>
<Link href="https://github.com/makeplane/plane" target="_blank" rel="noopener noreferrer">
<a className="flex items-center gap-1.5 bg-custom-background-80 text-xs font-medium py-1.5 px-3 rounded">
<Image
src={theme === "dark" ? githubWhiteImage : githubBlackImage}
height={16}
width={16}
alt="GitHub Logo"
/>
Star us on GitHub
</a>
</Link>
</div>
}
>
{isProductUpdatesModalOpen && ( {isProductUpdatesModalOpen && (
<ProductUpdatesModal <ProductUpdatesModal
isOpen={isProductUpdatesModalOpen} isOpen={isProductUpdatesModalOpen}
@ -93,27 +129,6 @@ const WorkspacePage: NextPage = () => {
projects.length > 0 ? ( projects.length > 0 ? (
<div className="p-8"> <div className="p-8">
<div className="flex flex-col gap-8"> <div className="flex flex-col gap-8">
<div className="text-custom-text-200 flex flex-col justify-between gap-x-2 gap-y-6 rounded-lg border border-custom-border-200 bg-custom-background-100 px-4 py-6 md:flex-row md:items-center md:py-3">
<p className="font-medium text-custom-text-100">
Plane is open source, support us by starring us on GitHub.
</p>
<div className="flex items-center gap-2">
<button
onClick={() => setIsProductUpdatesModalOpen(true)}
className="rounded-md border-2 border-custom-border-200 px-3 py-1.5 text-sm font-medium hover:text-custom-text-100 duration-300"
>
What{"'"}s New?
</button>
<a
href="https://github.com/makeplane/plane"
target="_blank"
className="rounded-md border-2 border-custom-border-200 px-3 py-1.5 text-sm font-medium hover:text-custom-text-100 duration-300"
rel="noopener noreferrer"
>
Star us on GitHub
</a>
</div>
</div>
<IssuesStats data={workspaceDashboardData} /> <IssuesStats data={workspaceDashboardData} />
<div className="grid grid-cols-1 gap-8 lg:grid-cols-2"> <div className="grid grid-cols-1 gap-8 lg:grid-cols-2">
<IssuesList issues={workspaceDashboardData?.overdue_issues} type="overdue" /> <IssuesList issues={workspaceDashboardData?.overdue_issues} type="overdue" />