[WEB-808] style: workspace settings mobile responsiveness (#4047)

* [WEB-808] style: workspace settings mobile responsiveness

* fix: scroll on mobile-view

* responsiveness fixes

---------

Co-authored-by: LAKHAN BAHETI <lakhanbaheti9@gmail.com>
This commit is contained in:
Ramesh Kumar Chandra 2024-04-29 12:59:04 +05:30 committed by GitHub
parent 0c880bbbc8
commit 9c8b4afc20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 140 additions and 128 deletions

View File

@ -111,7 +111,7 @@ export const CreateApiTokenModal: React.FC<Props> = (props) => {
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 rounded-lg bg-custom-background-100 p-5 px-4 text-left shadow-custom-shadow-md transition-all sm:w-full sm:max-w-2xl"> <Dialog.Panel className="relative transform rounded-lg bg-custom-background-100 p-5 px-4 text-left shadow-custom-shadow-md transition-all w-full sm:max-w-2xl">
{generatedToken ? ( {generatedToken ? (
<GeneratedTokenDetails handleClose={handleClose} tokenDetails={generatedToken} /> <GeneratedTokenDetails handleClose={handleClose} tokenDetails={generatedToken} />
) : ( ) : (

View File

@ -28,8 +28,8 @@ export const GeneratedTokenDetails: React.FC<Props> = (props) => {
}; };
return ( return (
<div> <div className="w-full">
<div className="space-y-3"> <div className="w-full space-y-3 text-wrap">
<h3 className="text-lg font-medium leading-6 text-custom-text-100">Key created</h3> <h3 className="text-lg font-medium leading-6 text-custom-text-100">Key created</h3>
<p className="text-sm text-custom-text-400"> <p className="text-sm text-custom-text-400">
Copy and save this secret key in Plane Pages. You can{"'"}t see this key after you hit Close. A CSV file Copy and save this secret key in Plane Pages. You can{"'"}t see this key after you hit Close. A CSV file
@ -39,11 +39,11 @@ export const GeneratedTokenDetails: React.FC<Props> = (props) => {
<button <button
type="button" type="button"
onClick={() => copyApiToken(tokenDetails.token ?? "")} onClick={() => copyApiToken(tokenDetails.token ?? "")}
className="mt-4 flex w-full items-center justify-between rounded-md border-[0.5px] border-custom-border-200 px-3 py-2 text-sm font-medium outline-none" className="mt-4 flex truncate w-full items-center justify-between rounded-md border-[0.5px] border-custom-border-200 px-3 py-2 text-sm font-medium outline-none"
> >
{tokenDetails.token} <span className="truncate pr-2">{tokenDetails.token}</span>
<Tooltip tooltipContent="Copy secret key" isMobile={isMobile}> <Tooltip tooltipContent="Copy secret key" isMobile={isMobile}>
<Copy className="h-4 w-4 text-custom-text-400" /> <Copy className="h-4 w-4 text-custom-text-400 flex-shrink-0" />
</Tooltip> </Tooltip>
</button> </button>
<div className="mt-6 flex items-center justify-between"> <div className="mt-6 flex items-center justify-between">

View File

@ -1,13 +1,11 @@
import { FC } from "react"; import { FC } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// ui
import { Settings } from "lucide-react"; import { Settings } from "lucide-react";
import { Breadcrumbs, CustomMenu } from "@plane/ui"; // ui
// hooks import { Breadcrumbs } from "@plane/ui";
// components // components
import { BreadcrumbLink } from "@/components/common"; import { BreadcrumbLink } from "@/components/common";
import { WORKSPACE_SETTINGS_LINKS } from "@/constants/workspace";
export interface IWorkspaceSettingHeader { export interface IWorkspaceSettingHeader {
title: string; title: string;
@ -20,7 +18,7 @@ export const WorkspaceSettingHeader: FC<IWorkspaceSettingHeader> = observer((pro
const { workspaceSlug } = router.query; const { workspaceSlug } = router.query;
return ( return (
<div className="relative z-10 flex h-[3.75rem] w-full flex-shrink-0 flex-row items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> <div className="relative z-10 flex h-[3.75rem] w-full flex-shrink-0 flex-row items-center justify-between gap-x-2 gap-y-4 bg-custom-sidebar-background-100 p-4">
<div className="flex w-full flex-grow items-center gap-2 overflow-ellipsis whitespace-nowrap"> <div className="flex w-full flex-grow items-center gap-2 overflow-ellipsis whitespace-nowrap">
<div> <div>
<Breadcrumbs> <Breadcrumbs>
@ -34,28 +32,9 @@ export const WorkspaceSettingHeader: FC<IWorkspaceSettingHeader> = observer((pro
/> />
} }
/> />
<div className="hidden sm:hidden md:block lg:block">
<Breadcrumbs.BreadcrumbItem type="text" link={<BreadcrumbLink label={title} />} /> <Breadcrumbs.BreadcrumbItem type="text" link={<BreadcrumbLink label={title} />} />
</div>
</Breadcrumbs> </Breadcrumbs>
</div> </div>
<CustomMenu
className="flex-shrink-0 block sm:block md:hidden lg:hidden"
maxHeight="lg"
customButton={
<span className="text-xs px-1.5 py-1 border rounded-md text-custom-text-200 border-custom-border-300">
{title}
</span>
}
placement="bottom-start"
closeOnSelect
>
{WORKSPACE_SETTINGS_LINKS.map((item) => (
<CustomMenu.MenuItem key={item.key} onClick={() => router.push(`/${workspaceSlug}${item.href}`)}>
{item.label}
</CustomMenu.MenuItem>
))}
</CustomMenu>
</div> </div>
</div> </div>
); );

View File

@ -124,7 +124,7 @@ export const CreateWebhookModal: React.FC<ICreateWebhookModal> = (props) => {
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 border border-custom-border-200 bg-custom-background-100 p-6 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-2xl"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg border border-custom-border-200 bg-custom-background-100 p-6 text-left shadow-xl transition-all sm:my-8 w-full sm:max-w-2xl">
{!generatedWebhook ? ( {!generatedWebhook ? (
<WebhookForm onSubmit={handleCreateWebhook} handleClose={handleClose} /> <WebhookForm onSubmit={handleCreateWebhook} handleClose={handleClose} />
) : ( ) : (

View File

@ -94,15 +94,15 @@ export const WebhookSecretKey: FC<Props> = observer((props) => {
<div className="space-y-2"> <div className="space-y-2">
{webhookId && <div className="text-sm font-medium">Secret key</div>} {webhookId && <div className="text-sm font-medium">Secret key</div>}
<div className="text-xs text-custom-text-400">Generate a token to sign-in to the webhook payload</div> <div className="text-xs text-custom-text-400">Generate a token to sign-in to the webhook payload</div>
<div className="flex items-center gap-4"> <div className="flex flex-col md:flex-row md:items-center gap-4">
<div className="flex flex-grow max-w-lg items-center justify-between self-stretch rounded border border-custom-border-200 px-2 py-1.5"> <div className="flex flex-grow max-w-lg items-center justify-between self-stretch rounded border border-custom-border-200 px-2 h-8">
<div className="select-none overflow-hidden font-medium"> <div className="select-none overflow-hidden font-medium">
{shouldShowKey ? ( {shouldShowKey ? (
<p className="text-xs">{webhookSecretKey}</p> <p className="text-xs">{webhookSecretKey}</p>
) : ( ) : (
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-1.5 overflow-hidden mr-2">
{[...Array(30)].map((_, index) => ( {[...Array(30)].map((_, index) => (
<div key={index} className="h-1 w-1 rounded-full bg-custom-text-400" /> <div key={index} className="h-1 w-1 rounded-full bg-custom-text-400 flex-shrink-0" />
))} ))}
</div> </div>
)} )}

View File

@ -104,7 +104,7 @@ export const SendWorkspaceInvitationModal: React.FC<Props> = observer((props) =>
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 translate-y-0 transform rounded-lg bg-custom-background-100 p-5 text-left opacity-100 shadow-custom-shadow-md transition-all sm:w-full sm:max-w-2xl sm:scale-100"> <Dialog.Panel className="relative translate-y-0 transform rounded-lg bg-custom-background-100 p-5 text-left opacity-100 shadow-custom-shadow-md transition-all w-full sm:max-w-2xl sm:scale-100">
<form <form
onSubmit={handleSubmit(onSubmitForm)} onSubmit={handleSubmit(onSubmitForm)}
onKeyDown={(e) => { onKeyDown={(e) => {
@ -121,8 +121,8 @@ export const SendWorkspaceInvitationModal: React.FC<Props> = observer((props) =>
<div className="mb-3 space-y-4"> <div className="mb-3 space-y-4">
{fields.map((field, index) => ( {fields.map((field, index) => (
<div key={field.id} className="group relative grid grid-cols-12 items-start gap-4"> <div key={field.id} className="group relative flex items-start gap-4">
<div className="col-span-9"> <div className="w-full">
<Controller <Controller
control={control} control={control}
name={`emails.${index}.email`} name={`emails.${index}.email`}
@ -155,7 +155,7 @@ export const SendWorkspaceInvitationModal: React.FC<Props> = observer((props) =>
)} )}
/> />
</div> </div>
<div className="col-span-3 flex items-center gap-2"> <div className="flex items-center gap-2">
<Controller <Controller
control={control} control={control}
name={`emails.${index}.role`} name={`emails.${index}.role`}

View File

@ -104,8 +104,8 @@ export const WorkspaceMembersListItem: FC<Props> = observer((props) => {
}} }}
onSubmit={handleRemove} onSubmit={handleRemove}
/> />
<div className="group flex items-center justify-between px-3 py-4 hover:bg-custom-background-90"> <div className="group w-full flex items-center justify-between px-3 py-4 hover:bg-custom-background-90">
<div className="flex items-center gap-x-4 gap-y-2"> <div className="flex w-full items-center gap-x-4 gap-y-2">
{memberDetails.member.avatar && memberDetails.member.avatar.trim() !== "" ? ( {memberDetails.member.avatar && memberDetails.member.avatar.trim() !== "" ? (
<Link href={`/${workspaceSlug}/profile/${memberDetails.member.id}`}> <Link href={`/${workspaceSlug}/profile/${memberDetails.member.id}`}>
<span className="relative flex h-10 w-10 items-center justify-center rounded p-4 capitalize text-white"> <span className="relative flex h-10 w-10 items-center justify-center rounded p-4 capitalize text-white">
@ -123,24 +123,26 @@ export const WorkspaceMembersListItem: FC<Props> = observer((props) => {
</span> </span>
</Link> </Link>
)} )}
<div> <div className="w-full truncate flex items-center justify-between">
<Link href={`/${workspaceSlug}/profile/${memberDetails.member.id}`}> <div className="truncate">
<span className="text-sm font-medium"> <Link href={`/${workspaceSlug}/profile/${memberDetails.member.id}`} className="truncate">
<div className="w-full truncate">
<span className="text-sm font-medium truncate">
{memberDetails.member.first_name} {memberDetails.member.last_name} {memberDetails.member.first_name} {memberDetails.member.last_name}
</span> </span>
</div>
</Link> </Link>
<div className="flex items-center"> <div className="flex flex-col sm:flex-row items-start sm:items-center truncate">
<p className="text-xs text-custom-text-300">{memberDetails.member.display_name}</p> <p className="text-xs text-custom-text-300">{memberDetails.member.display_name}</p>
{isAdmin && ( {isAdmin && (
<> <>
<Dot height={16} width={16} className="text-custom-text-300" /> <Dot height={16} width={16} className="text-custom-text-300 hidden sm:block" />
<p className="text-xs text-custom-text-300">{memberDetails.member.email}</p> <p className="text-xs text-custom-text-300 line-clamp-1 truncate">{memberDetails.member.email}</p>
</> </>
)} )}
</div> </div>
</div> </div>
</div> <div className="flex flex-shrink-0 items-center gap-2 text-xs">
<div className="flex items-center gap-2 text-xs">
<CustomSelect <CustomSelect
customButton={ customButton={
<div className="item-center flex gap-1 rounded px-2 py-0.5"> <div className="item-center flex gap-1 rounded px-2 py-0.5">
@ -196,8 +198,8 @@ export const WorkspaceMembersListItem: FC<Props> = observer((props) => {
onClick={() => setRemoveMemberModal(true)} onClick={() => setRemoveMemberModal(true)}
className={ className={
isAdmin || isCurrentUser isAdmin || isCurrentUser
? "pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100" ? "pointer-events-none md:opacity-0 group-hover:pointer-events-auto md:group-hover:opacity-100"
: "pointer-events-none opacity-0" : "pointer-events-none hidden md:opacity-0 md:block"
} }
> >
<XCircle className="h-3.5 w-3.5 text-red-500" strokeWidth={2} /> <XCircle className="h-3.5 w-3.5 text-red-500" strokeWidth={2} />
@ -205,6 +207,8 @@ export const WorkspaceMembersListItem: FC<Props> = observer((props) => {
</Tooltip> </Tooltip>
</div> </div>
</div> </div>
</div>
</div>
</> </>
); );
}); });

View File

@ -0,0 +1,25 @@
import router from "next/router";
import { WORKSPACE_SETTINGS_LINKS } from "@/constants/workspace";
const MobileWorkspaceSettingsTabs = () => {
const { workspaceSlug } = router.query;
return (
<div className="flex-shrink-0 md:hidden sticky inset-0 flex overflow-x-auto bg-custom-background-100 z-10">
{WORKSPACE_SETTINGS_LINKS.map((item, index) => (
<div
className={`${
item.highlight(router.asPath, `/${workspaceSlug}`)
? "text-custom-primary-100 text-sm py-2 px-3 whitespace-nowrap flex flex-grow cursor-pointer justify-around border-b border-custom-primary-200"
: "text-custom-text-200 flex flex-grow cursor-pointer justify-around border-b border-custom-border-200 text-sm py-2 px-3 whitespace-nowrap"
}`}
key={index}
onClick={() => router.push(`/${workspaceSlug}${item.href}`)}
>
{item.label}
</div>
))}
</div>
);
};
export default MobileWorkspaceSettingsTabs;

View File

@ -174,7 +174,7 @@ export const WorkspaceDetails: FC = observer(() => {
/> />
)} )}
/> />
<div className={`w-full overflow-y-auto py-8 pr-9 ${isAdmin ? "" : "opacity-60"}`}> <div className={`w-full overflow-y-auto md:py-8 py-4 md:pr-9 pr-4 ${isAdmin ? "" : "opacity-60"}`}>
<div className="flex items-center gap-5 border-b border-custom-border-100 pb-7"> <div className="flex items-center gap-5 border-b border-custom-border-100 pb-7">
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
<button type="button" onClick={() => setIsImageUploadModalOpen(true)} disabled={!isAdmin}> <button type="button" onClick={() => setIsImageUploadModalOpen(true)} disabled={!isAdmin}>
@ -195,7 +195,7 @@ export const WorkspaceDetails: FC = observer(() => {
</div> </div>
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
<h3 className="text-lg font-semibold leading-6">{watch("name")}</h3> <h3 className="text-lg font-semibold leading-6">{watch("name")}</h3>
<button type="button" onClick={handleCopyUrl} className="text-sm tracking-tight">{`${ <button type="button" onClick={handleCopyUrl} className="text-sm tracking-tight text-left">{`${
typeof window !== "undefined" && window.location.origin.replace("http://", "").replace("https://", "") typeof window !== "undefined" && window.location.origin.replace("http://", "").replace("https://", "")
}/${currentWorkspace.slug}`}</button> }/${currentWorkspace.slug}`}</button>
{isAdmin && ( {isAdmin && (

View File

@ -1,5 +1,6 @@
import { FC, ReactNode } from "react"; import { FC, ReactNode } from "react";
// components // components
import MobileWorkspaceSettingsTabs from "@/components/workspace/settings/mobile-workspace-settings-tabs";
import { WorkspaceSettingsSidebar } from "./sidebar"; import { WorkspaceSettingsSidebar } from "./sidebar";
export interface IWorkspaceSettingLayout { export interface IWorkspaceSettingLayout {
@ -14,9 +15,12 @@ export const WorkspaceSettingLayout: FC<IWorkspaceSettingLayout> = (props) => {
<div className="w-80 flex-shrink-0 overflow-y-hidden pt-8 sm:hidden hidden md:block lg:block"> <div className="w-80 flex-shrink-0 overflow-y-hidden pt-8 sm:hidden hidden md:block lg:block">
<WorkspaceSettingsSidebar /> <WorkspaceSettingsSidebar />
</div> </div>
<div className="w-full pl-10 sm:pl-10 md:pl-0 lg:pl-0 overflow-x-hidden overflow-y-scroll vertical-scrollbar scrollbar-md"> <div className="flex flex-col relative w-full overflow-hidden">
<MobileWorkspaceSettingsTabs />
<div className="w-full pl-4 md:pl-0 md:py-8 py-2 overflow-x-hidden overflow-y-scroll vertical-scrollbar scrollbar-md">
{children} {children}
</div> </div>
</div> </div>
</div>
); );
}; };

View File

@ -64,7 +64,7 @@ const ApiTokensPage: NextPageWithLayout = observer(() => {
<> <>
<PageHead title={pageTitle} /> <PageHead title={pageTitle} />
<CreateApiTokenModal isOpen={isCreateTokenModalOpen} onClose={() => setIsCreateTokenModalOpen(false)} /> <CreateApiTokenModal isOpen={isCreateTokenModalOpen} onClose={() => setIsCreateTokenModalOpen(false)} />
<section className="w-full overflow-y-auto py-8 pr-9 "> <section className="w-full overflow-y-auto md:pr-9 pr-4">
{tokens.length > 0 ? ( {tokens.length > 0 ? (
<> <>
<div className="flex items-center justify-between border-b border-custom-border-200 py-3.5"> <div className="flex items-center justify-between border-b border-custom-border-200 py-3.5">

View File

@ -37,7 +37,7 @@ const BillingSettingsPage: NextPageWithLayout = observer(() => {
return ( return (
<> <>
<PageHead title={pageTitle} /> <PageHead title={pageTitle} />
<section className="w-full overflow-y-auto py-8 pr-9"> <section className="w-full overflow-y-auto md:pr-9 pr-4">
<div> <div>
<div className="flex items-center border-b border-custom-border-100 py-3.5"> <div className="flex items-center border-b border-custom-border-100 py-3.5">
<h3 className="text-xl font-medium">Billing & Plans</h3> <h3 className="text-xl font-medium">Billing & Plans</h3>

View File

@ -38,7 +38,7 @@ const ExportsPage: NextPageWithLayout = observer(() => {
return ( return (
<> <>
<PageHead title={pageTitle} /> <PageHead title={pageTitle} />
<div className="w-full overflow-y-auto py-8 pr-9"> <div className="w-full overflow-y-auto md:pr-9 pr-4">
<div className="flex items-center border-b border-custom-border-100 py-3.5"> <div className="flex items-center border-b border-custom-border-100 py-3.5">
<h3 className="text-xl font-medium">Exports</h3> <h3 className="text-xl font-medium">Exports</h3>
</div> </div>

View File

@ -95,7 +95,7 @@ const WorkspaceMembersSettingsPage: NextPageWithLayout = observer(() => {
onClose={() => setInviteModal(false)} onClose={() => setInviteModal(false)}
onSubmit={handleWorkspaceInvite} onSubmit={handleWorkspaceInvite}
/> />
<section className="w-full overflow-y-auto py-8 pr-9"> <section className="w-full overflow-y-auto md:pr-9 pr-4">
<div className="flex items-center justify-between gap-4 border-b border-custom-border-100 py-3.5"> <div className="flex items-center justify-between gap-4 border-b border-custom-border-100 py-3.5">
<h4 className="text-xl font-medium">Members</h4> <h4 className="text-xl font-medium">Members</h4>
<div className="ml-auto flex items-center gap-1.5 rounded-md border border-custom-border-200 bg-custom-background-100 px-2.5 py-1.5"> <div className="ml-auto flex items-center gap-1.5 rounded-md border border-custom-border-200 bg-custom-background-100 px-2.5 py-1.5">

View File

@ -95,7 +95,7 @@ const WebhookDetailsPage: NextPageWithLayout = observer(() => {
<> <>
<PageHead title={pageTitle} /> <PageHead title={pageTitle} />
<DeleteWebhookModal isOpen={deleteWebhookModal} onClose={() => setDeleteWebhookModal(false)} /> <DeleteWebhookModal isOpen={deleteWebhookModal} onClose={() => setDeleteWebhookModal(false)} />
<div className="w-full space-y-8 overflow-y-auto py-8 pr-9"> <div className="w-full space-y-8 overflow-y-auto md:py-8 py-4 md:pr-9 pr-4">
<WebhookForm onSubmit={async (data) => await handleUpdateWebhook(data)} data={currentWebhook} /> <WebhookForm onSubmit={async (data) => await handleUpdateWebhook(data)} data={currentWebhook} />
{currentWebhook && <WebhookDeleteSection openDeleteModal={() => setDeleteWebhookModal(true)} />} {currentWebhook && <WebhookDeleteSection openDeleteModal={() => setDeleteWebhookModal(true)} />}
</div> </div>

View File

@ -62,7 +62,7 @@ const WebhooksListPage: NextPageWithLayout = observer(() => {
return ( return (
<> <>
<PageHead title={pageTitle} /> <PageHead title={pageTitle} />
<div className="w-full overflow-y-auto py-8 pr-9"> <div className="w-full overflow-y-auto md:pr-9 pr-4">
<CreateWebhookModal <CreateWebhookModal
createWebhook={createWebhook} createWebhook={createWebhook}
clearSecretKey={clearSecretKey} clearSecretKey={clearSecretKey}
@ -74,7 +74,7 @@ const WebhooksListPage: NextPageWithLayout = observer(() => {
/> />
{Object.keys(webhooks).length > 0 ? ( {Object.keys(webhooks).length > 0 ? (
<div className="flex h-full w-full flex-col"> <div className="flex h-full w-full flex-col">
<div className="flex items-center justify-between gap-4 border-b border-custom-border-200 pb-3.5"> <div className="flex items-center justify-between gap-4 border-b border-custom-border-200 py-3.5">
<div className="text-xl font-medium">Webhooks</div> <div className="text-xl font-medium">Webhooks</div>
<Button variant="primary" size="sm" onClick={() => setShowCreateWebhookModal(true)}> <Button variant="primary" size="sm" onClick={() => setShowCreateWebhookModal(true)}>
Add webhook Add webhook