dev: sync staging with master

This commit is contained in:
vamsi 2022-11-25 00:40:36 +05:30
commit 6d7abf6590
36 changed files with 1449 additions and 1366 deletions

View file

@ -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>
);

View file

@ -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>

View file

@ -59,7 +59,7 @@ const navigation = (projectId: string) => [
},
];
const navLinks = [
const workspaceLinks = [
{
icon: HomeIcon,
name: "Home",
@ -118,7 +118,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}>
@ -204,7 +204,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
@ -216,7 +216,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"
: ""
}`}
>
<div className="flex gap-x-1 items-center">
@ -386,12 +388,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" : ""
}`}
>
@ -405,6 +409,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
@ -446,8 +461,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" : ""
)}
>
@ -492,8 +507,8 @@ const Sidebar: React.FC = () => {
<div className="px-2 py-2 bg-gray-50 w-full self-baseline flex items-center gap-x-2">
<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()}
>

View file

@ -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;