forked from github/plane
dev: profile page, issue details page design
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
import React from "react";
|
||||
|
||||
// react
|
||||
import React, { useState } from "react";
|
||||
// layouts
|
||||
import Container from "layouts/Container";
|
||||
|
||||
import Sidebar from "layouts/Navbar/Sidebar";
|
||||
// components
|
||||
import CreateProjectModal from "components/project/CreateProjectModal";
|
||||
// types
|
||||
import type { Props } from "./types";
|
||||
|
||||
const AdminLayout: React.FC<Props> = ({ meta, children }) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<Container meta={meta}>
|
||||
<div className="w-full h-screen overflow-auto">
|
||||
<>{children}</>
|
||||
<CreateProjectModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
||||
<div className="h-screen w-full flex overflow-x-hidden">
|
||||
<Sidebar />
|
||||
<main className="h-full w-full min-w-0 p-5 bg-primary overflow-y-auto">{children}</main>
|
||||
</div>
|
||||
</Container>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// next
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
// types
|
||||
import type { Props } from "./types";
|
||||
// constants
|
||||
import {
|
||||
SITE_NAME,
|
||||
SITE_DESCRIPTION,
|
||||
@@ -10,9 +13,6 @@ import {
|
||||
SITE_TITLE,
|
||||
} from "constants/seo/seo-variables";
|
||||
|
||||
// types
|
||||
import type { Props } from "./types";
|
||||
|
||||
const Container = ({ meta, children }: Props) => {
|
||||
const router = useRouter();
|
||||
const image = meta?.image || "/site-image.png";
|
||||
@@ -31,35 +31,16 @@ const Container = ({ meta, children }: Props) => {
|
||||
<meta property="og:description" content={description} />
|
||||
<meta name="keywords" content={SITE_KEYWORDS} />
|
||||
<meta name="twitter:site" content={`@${TWITTER_USER_NAME}`} />
|
||||
<meta
|
||||
name="twitter:card"
|
||||
content={image ? "summary_large_image" : "summary"}
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="/favicon/apple-touch-icon.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="/favicon/favicon-32x32.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="/favicon/favicon-16x16.png"
|
||||
/>
|
||||
<meta name="twitter:card" content={image ? "summary_large_image" : "summary"} />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/site.webmanifest.json" />
|
||||
<link rel="shortcut icon" href="/favicon/favicon.ico" />
|
||||
{image && (
|
||||
<meta
|
||||
property="og:image"
|
||||
content={
|
||||
image.startsWith("https://") ? image : `${SITE_URL}${image}`
|
||||
}
|
||||
content={image.startsWith("https://") ? image : `${SITE_URL}${image}`}
|
||||
/>
|
||||
)}
|
||||
</Head>
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
XMarkIcon,
|
||||
InboxIcon,
|
||||
ArrowLongLeftIcon,
|
||||
QuestionMarkCircleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
// constants
|
||||
import { classNames } from "constants/common";
|
||||
@@ -57,7 +58,7 @@ const navigation = (projectId: string) => [
|
||||
},
|
||||
];
|
||||
|
||||
const navLinks = [
|
||||
const workspaceLinks = [
|
||||
{
|
||||
icon: HomeIcon,
|
||||
name: "Home",
|
||||
@@ -116,7 +117,7 @@ const Sidebar: React.FC = () => {
|
||||
const { collapsed: sidebarCollapse, toggleCollapsed } = useTheme();
|
||||
|
||||
return (
|
||||
<nav className="h-screen">
|
||||
<nav className="h-full">
|
||||
<CreateProjectModal isOpen={isCreateProjectModal} setIsOpen={setCreateProjectModal} />
|
||||
<Transition.Root show={sidebarOpen} as={React.Fragment}>
|
||||
<Dialog as="div" className="relative z-40 md:hidden" onClose={setSidebarOpen}>
|
||||
@@ -202,7 +203,7 @@ const Sidebar: React.FC = () => {
|
||||
sidebarCollapse ? "" : "w-auto md:w-64"
|
||||
} hidden md:inset-y-0 md:flex md:flex-col h-full`}
|
||||
>
|
||||
<div className="h-full flex flex-1 flex-col border-r border-gray-200">
|
||||
<div className="flex flex-1 flex-col border-r border-gray-200">
|
||||
<div className="h-full flex flex-1 flex-col pt-5">
|
||||
<div className="px-2">
|
||||
<div className={`relative ${sidebarCollapse ? "flex" : "grid grid-cols-5 gap-1"}`}>
|
||||
@@ -210,7 +211,9 @@ const Sidebar: React.FC = () => {
|
||||
<div className="w-full">
|
||||
<Menu.Button
|
||||
className={`inline-flex justify-between items-center w-full rounded-md px-2 py-2 text-sm font-semibold text-gray-700 focus:outline-none ${
|
||||
!sidebarCollapse ? "hover:bg-gray-50 border border-gray-300 shadow-sm" : ""
|
||||
!sidebarCollapse
|
||||
? "hover:bg-gray-50 focus:bg-gray-50 border border-gray-300 shadow-sm"
|
||||
: ""
|
||||
}`}
|
||||
>
|
||||
<span className="flex gap-x-1 items-center">
|
||||
@@ -302,7 +305,7 @@ const Sidebar: React.FC = () => {
|
||||
{!sidebarCollapse && (
|
||||
<Menu as="div" className="inline-block text-left w-full">
|
||||
<div className="h-full w-full">
|
||||
<Menu.Button className="grid place-items-center h-full w-full rounded-md shadow-sm px-2 py-2 bg-white border border-gray-300 text-gray-700 hover:bg-gray-50 focus:outline-none">
|
||||
<Menu.Button className="grid place-items-center h-full w-full rounded-md shadow-sm px-2 py-2 bg-white border border-gray-300 text-gray-700 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none">
|
||||
<UserIcon className="h-5 w-5" />
|
||||
</Menu.Button>
|
||||
</div>
|
||||
@@ -361,12 +364,14 @@ const Sidebar: React.FC = () => {
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-3 flex-1 space-y-1 bg-white">
|
||||
{navLinks.map((link, index) => (
|
||||
{workspaceLinks.map((link, index) => (
|
||||
<Link key={index} href={link.href}>
|
||||
<a
|
||||
className={`${
|
||||
link.href === router.asPath ? "bg-theme text-white" : "hover:bg-indigo-100"
|
||||
} group flex items-center gap-3 px-2 py-2 text-xs font-medium rounded-md ${
|
||||
link.href === router.asPath
|
||||
? "bg-theme text-white"
|
||||
: "hover:bg-indigo-100 focus:bg-indigo-100"
|
||||
} flex items-center gap-3 p-2 text-xs font-medium rounded-md outline-none ${
|
||||
sidebarCollapse ? "justify-center" : ""
|
||||
}`}
|
||||
>
|
||||
@@ -380,6 +385,17 @@ const Sidebar: React.FC = () => {
|
||||
</a>
|
||||
</Link>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className="w-full flex items-center gap-3 p-2 hover:bg-indigo-100 text-xs font-medium rounded-md outline-none"
|
||||
onClick={() => {
|
||||
const e = new KeyboardEvent("keydown", { key: "h", ctrlKey: true });
|
||||
document.dispatchEvent(e);
|
||||
}}
|
||||
>
|
||||
<QuestionMarkCircleIcon className="flex-shrink-0 h-4 w-4" />
|
||||
{!sidebarCollapse && "Help Centre"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -421,8 +437,8 @@ const Sidebar: React.FC = () => {
|
||||
className={classNames(
|
||||
item.href === router.asPath
|
||||
? "bg-gray-200 text-gray-900"
|
||||
: "text-gray-500 hover:bg-gray-100 hover:text-gray-900",
|
||||
"group flex items-center px-2 py-2 text-xs font-medium rounded-md",
|
||||
: "text-gray-500 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900",
|
||||
"group flex items-center px-2 py-2 text-xs font-medium rounded-md outline-none",
|
||||
sidebarCollapse ? "justify-center" : ""
|
||||
)}
|
||||
>
|
||||
@@ -467,8 +483,8 @@ const Sidebar: React.FC = () => {
|
||||
<div className="px-2 py-2 bg-gray-50 w-full self-baseline">
|
||||
<button
|
||||
type="button"
|
||||
className={`flex items-center gap-3 px-2 py-2 text-xs font-medium rounded-md text-gray-500 hover:bg-gray-100 hover:text-gray-900 w-full ${
|
||||
sidebarCollapse ? "justify-center" : ""
|
||||
className={`flex items-center gap-3 px-2 py-2 text-xs font-medium rounded-md text-gray-500 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900 outline-none ${
|
||||
sidebarCollapse ? "justify-center w-full" : ""
|
||||
}`}
|
||||
onClick={() => toggleCollapsed()}
|
||||
>
|
||||
@@ -477,7 +493,6 @@ const Sidebar: React.FC = () => {
|
||||
sidebarCollapse ? "rotate-180" : ""
|
||||
}`}
|
||||
/>
|
||||
{!sidebarCollapse && "Collapse"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import React, { useState } from "react";
|
||||
// components
|
||||
import CreateProjectModal from "components/project/CreateProjectModal";
|
||||
// layouts
|
||||
import AdminLayout from "layouts/AdminLayout";
|
||||
// types
|
||||
import type { Props } from "./types";
|
||||
// components
|
||||
import Sidebar from "./Navbar/Sidebar";
|
||||
|
||||
const ProjectLayouts: React.FC<Props> = ({ children, meta }) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<AdminLayout meta={meta}>
|
||||
<CreateProjectModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
||||
<div className="h-full w-full overflow-x-hidden relative flex">
|
||||
<Sidebar />
|
||||
<main className="h-full w-full mx-auto min-w-0 pb-6 overflow-y-hidden">
|
||||
<div className="h-full w-full px-8 py-6 overflow-auto">{children}</div>
|
||||
</main>
|
||||
</div>
|
||||
</AdminLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProjectLayouts;
|
||||
Reference in New Issue
Block a user