chore: settings bug fixes and ui improvement (#2198)

* fix: settings bug fixes and ui improvement

* chore: setting sidebar scroll fix & code refactor
This commit is contained in:
Anmol Singh Bhatia 2023-09-15 19:30:53 +05:30 committed by GitHub
parent 3d72279edb
commit 5d331477ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 108 additions and 101 deletions

View File

@ -147,7 +147,9 @@ const IntegrationGuide = () => {
</div> </div>
</div> </div>
) : ( ) : (
<p className="py-2 text-sm text-custom-text-200">No previous export available.</p> <p className="text-sm text-custom-text-200 px-4 py-6">
No previous export available.
</p>
) )
) : ( ) : (
<Loader className="mt-6 grid grid-cols-1 gap-3"> <Loader className="mt-6 grid grid-cols-1 gap-3">

View File

@ -129,7 +129,7 @@ const IntegrationGuide = () => {
</button> </button>
</h3> </h3>
</div> </div>
<div className="flex flex-col px-4 py-6"> <div className="flex flex-col">
{importerServices ? ( {importerServices ? (
importerServices.length > 0 ? ( importerServices.length > 0 ? (
<div className="space-y-2"> <div className="space-y-2">
@ -145,7 +145,7 @@ const IntegrationGuide = () => {
</div> </div>
</div> </div>
) : ( ) : (
<p className="py-2 text-sm text-custom-text-200"> <p className="text-sm text-custom-text-200 px-4 py-6">
No previous imports available. No previous imports available.
</p> </p>
) )

View File

@ -8,6 +8,8 @@ import useSWR from "swr";
import projectService from "services/project.service"; import projectService from "services/project.service";
// ui // ui
import { Avatar, CustomSearchSelect } from "components/ui"; import { Avatar, CustomSearchSelect } from "components/ui";
// icon
import { Ban } from "lucide-react";
// fetch-keys // fetch-keys
import { PROJECT_MEMBERS } from "constants/fetch-keys"; import { PROJECT_MEMBERS } from "constants/fetch-keys";
@ -49,7 +51,10 @@ export const MemberSelect: React.FC<Props> = ({ value, onChange }) => {
{selectedOption ? ( {selectedOption ? (
selectedOption?.display_name selectedOption?.display_name
) : ( ) : (
<span className="text-sm py-0.5 text-custom-sidebar-text-400">Select</span> <div className="flex items-center gap-2">
<Ban className="h-3.5 w-3.5 text-custom-sidebar-text-400 rotate-90" />
<span className="text-sm py-0.5 text-custom-sidebar-text-400">None</span>
</div>
)} )}
</div> </div>
} }
@ -61,7 +66,12 @@ export const MemberSelect: React.FC<Props> = ({ value, onChange }) => {
{ {
value: "none", value: "none",
query: "none", query: "none",
content: <div className="flex items-center gap-2">None</div>, content: (
<div className="flex items-center gap-2">
<Ban className="h-3.5 w-3.5 text-custom-sidebar-text-400 rotate-90" />
<span className="text-sm py-0.5 text-custom-sidebar-text-400">None</span>
</div>
),
}, },
] ]
} }

View File

@ -2,11 +2,7 @@ import React from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Link from "next/link"; import Link from "next/link";
type Props = { export const SettingsSidebar = () => {
profilePage?: boolean;
};
export const SettingsSidebar: React.FC<Props> = ({ profilePage = false }) => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;

View File

@ -38,13 +38,13 @@ const ProfileActivity = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
{userActivity ? ( {userActivity ? (
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Acitivity</h3> <h3 className="text-xl font-medium">Acitivity</h3>
</div> </div>
@ -168,7 +168,7 @@ const ProfileActivity = () => {
/> />
) : ( ) : (
<div <div
className={`grid h-7 w-7 place-items-center rounded-full border-2 border-white bg-gray-700 text-xs text-white`} className={`grid h-6 w-6 place-items-center rounded-full border-2 border-white bg-gray-700 text-xs text-white`}
> >
{activityItem.actor_detail.display_name?.charAt(0)} {activityItem.actor_detail.display_name?.charAt(0)}
</div> </div>

View File

@ -167,11 +167,11 @@ const Profile: NextPage = () => {
/> />
{myProfile ? ( {myProfile ? (
<form onSubmit={handleSubmit(onSubmit)}> <form onSubmit={handleSubmit(onSubmit)}>
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<div className={`flex flex-col gap-8 pr-9 py-9 w-full`}> <div className={`flex flex-col gap-8 pr-9 py-9 w-full overflow-y-auto`}>
<div className="relative h-44 w-full mt-6"> <div className="relative h-44 w-full mt-6">
<img <img
src={ src={

View File

@ -59,12 +59,12 @@ const ProfilePreferences = observer(() => {
} }
> >
{myProfile ? ( {myProfile ? (
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<div className="pr-9 py-8 w-full"> <div className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Acitivity</h3> <h3 className="text-xl font-medium">Acitivity</h3>
</div> </div>

View File

@ -75,11 +75,11 @@ const AutomationsSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Automations</h3> <h3 className="text-xl font-medium">Automations</h3>
</div> </div>

View File

@ -125,11 +125,11 @@ const EstimatesSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2 h-full overflow-hidden"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<div className="pr-9 py-8 flex flex-col w-full"> <div className="pr-9 py-8 flex flex-col w-full overflow-y-auto">
<section className="flex items-center justify-between pt-2 pb-3.5 border-b border-custom-border-200"> <section className="flex items-center justify-between pt-2 pb-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Estimates</h3> <h3 className="text-xl font-medium">Estimates</h3>
<div className="col-span-12 space-y-5 sm:col-span-7"> <div className="col-span-12 space-y-5 sm:col-span-7">

View File

@ -153,11 +153,11 @@ const FeaturesSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Features</h3> <h3 className="text-xl font-medium">Features</h3>
</div> </div>

View File

@ -190,21 +190,21 @@ const GeneralSettings: NextPage = () => {
onClose={() => setSelectedProject(null)} onClose={() => setSelectedProject(null)}
user={user} user={user}
/> />
<form onSubmit={handleSubmit(onSubmit)}> <div className="flex flex-row gap-2 h-full">
<div className="flex flex-row gap-2"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<div className="w-80 py-8"> <SettingsSidebar />
<SettingsSidebar /> </div>
</div> <div className={`pr-9 py-8 w-full overflow-y-auto ${isAdmin ? "" : "opacity-60"}`}>
<div className={`pr-9 py-8 w-full ${isAdmin ? "" : "opacity-60"}`}> <form onSubmit={handleSubmit(onSubmit)}>
<div className="relative h-44 w-full mt-6"> <div className="relative h-44 w-full mt-6">
<img <img
src={watch("cover_image")!} src={watch("cover_image")!}
alt={watch("cover_image")!} alt={watch("cover_image")!}
className="h-44 w-full rounded-md object-cover" className="h-44 w-full rounded-md object-cover"
/> />
<div className="flex items-end justify-between absolute bottom-4 w-full px-4"> <div className="flex items-end justify-between gap-3 absolute bottom-4 w-full px-4">
<div className="flex gap-3"> <div className="flex gap-3 flex-grow truncate">
<div className="flex items-center justify-center bg-custom-background-90 h-[52px] w-[52px] rounded-lg"> <div className="flex items-center justify-center flex-shrink-0 bg-custom-background-90 h-[52px] w-[52px] rounded-lg">
{projectDetails ? ( {projectDetails ? (
<div className="h-7 w-7 grid place-items-center"> <div className="h-7 w-7 grid place-items-center">
<Controller <Controller
@ -226,8 +226,8 @@ const GeneralSettings: NextPage = () => {
</Loader> </Loader>
)} )}
</div> </div>
<div className="flex flex-col gap-1 text-white"> <div className="flex flex-col gap-1 text-white truncate">
<span className="text-lg font-semibold">{watch("name")}</span> <span className="text-lg font-semibold truncate">{watch("name")}</span>
<span className="flex items-center gap-2 text-sm"> <span className="flex items-center gap-2 text-sm">
<span> <span>
{watch("identifier")} . {currentNetwork?.label} {watch("identifier")} . {currentNetwork?.label}
@ -236,7 +236,7 @@ const GeneralSettings: NextPage = () => {
</div> </div>
</div> </div>
<div className="flex justify-center"> <div className="flex justify-center flex-shrink-0">
{projectDetails ? ( {projectDetails ? (
<div> <div>
<Controller <Controller
@ -442,9 +442,9 @@ const GeneralSettings: NextPage = () => {
)} )}
</Disclosure> </Disclosure>
)} )}
</div> </form>
</div> </div>
</form> </div>
</ProjectAuthorizationWrapper> </ProjectAuthorizationWrapper>
); );
}; };

View File

@ -54,18 +54,20 @@ const ProjectIntegrations: NextPage = () => {
link={`/${workspaceSlug}/projects/${projectId}/issues`} link={`/${workspaceSlug}/projects/${projectId}/issues`}
linkTruncate linkTruncate
/> />
<BreadcrumbItem title="Integrations" unshrinkTitle /> <BreadcrumbItem title="Integrations Settings" unshrinkTitle />
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2 h-full overflow-hidden"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
{workspaceIntegrations ? ( <div className="pr-9 py-8 gap-10 w-full overflow-y-auto">
workspaceIntegrations.length > 0 ? ( <div className="flex items-center py-3.5 border-b border-custom-border-200">
<section className="pr-9 py-8 overflow-y-auto w-full"> <h3 className="text-xl font-medium">Integrations</h3>
<IntegrationAndImportExportBanner bannerName="Integrations" /> </div>
{workspaceIntegrations ? (
workspaceIntegrations.length > 0 ? (
<div> <div>
{workspaceIntegrations.map((integration) => ( {workspaceIntegrations.map((integration) => (
<SingleIntegration <SingleIntegration
@ -74,26 +76,26 @@ const ProjectIntegrations: NextPage = () => {
/> />
))} ))}
</div> </div>
</section> ) : (
<EmptyState
title="You haven't configured integrations"
description="Configure GitHub and other integrations to sync your project issues."
image={emptyIntegration}
primaryButton={{
text: "Configure now",
onClick: () => router.push(`/${workspaceSlug}/settings/integrations`),
}}
/>
)
) : ( ) : (
<EmptyState <Loader className="space-y-5">
title="You haven't configured integrations" <Loader.Item height="40px" />
description="Configure GitHub and other integrations to sync your project issues." <Loader.Item height="40px" />
image={emptyIntegration} <Loader.Item height="40px" />
primaryButton={{ <Loader.Item height="40px" />
text: "Configure now", </Loader>
onClick: () => router.push(`/${workspaceSlug}/settings/integrations`), )}
}} </div>
/>
)
) : (
<Loader className="space-y-5">
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
</Loader>
)}
</div> </div>
</ProjectAuthorizationWrapper> </ProjectAuthorizationWrapper>
); );

View File

@ -113,11 +113,11 @@ const LabelsSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2 h-full w-full"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 gap-10 h-full w-full"> <section className="pr-9 py-8 gap-10 w-full overflow-y-auto">
<div className="flex items-center justify-between pt-2 pb-3.5 border-b border-custom-border-200"> <div className="flex items-center justify-between pt-2 pb-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Labels</h3> <h3 className="text-xl font-medium">Labels</h3>

View File

@ -273,11 +273,11 @@ const MembersSettings: NextPage = () => {
user={user} user={user}
onSuccess={() => mutateMembers()} onSuccess={() => mutateMembers()}
/> />
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Defaults</h3> <h3 className="text-xl font-medium">Defaults</h3>
</div> </div>

View File

@ -73,11 +73,11 @@ const StatesSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<div className="pr-9 py-8 gap-10 w-full"> <div className="pr-9 py-8 gap-10 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">States</h3> <h3 className="text-xl font-medium">States</h3>
</div> </div>

View File

@ -43,11 +43,11 @@ const BillingSettings: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2 h-full overflow-hidden"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div> <div>
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Billing & Plan</h3> <h3 className="text-xl font-medium">Billing & Plan</h3>

View File

@ -40,11 +40,11 @@ const ImportExport: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<div className="pr-9 py-8 overflow-y-auto w-full"> <div className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Exports</h3> <h3 className="text-xl font-medium">Exports</h3>
</div> </div>

View File

@ -40,18 +40,15 @@ const ImportExport: NextPage = () => {
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2 h-full overflow-hidden"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center py-3.5 border-b border-custom-border-200"> <div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Imports</h3> <h3 className="text-xl font-medium">Imports</h3>
</div> </div>
<IntegrationGuide /> <IntegrationGuide />
<div className="flex items-center py-3.5 border-b border-custom-border-200">
<h3 className="text-xl font-medium">Previous Imports</h3>
</div>
</section> </section>
</div> </div>
</WorkspaceAuthorizationLayout> </WorkspaceAuthorizationLayout>

View File

@ -183,12 +183,12 @@ const WorkspaceSettings: NextPage = () => {
data={activeWorkspace ?? null} data={activeWorkspace ?? null}
user={user} user={user}
/> />
<div className="flex flex-row gap-2 h-full w-full"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
{activeWorkspace ? ( {activeWorkspace ? (
<div className={`pr-9 py-8 w-full ${isAdmin ? "" : "opacity-60"}`}> <div className={`pr-9 py-8 w-full overflow-y-auto ${isAdmin ? "" : "opacity-60"}`}>
<div className="flex gap-5 items-center pb-7 border-b border-custom-border-200"> <div className="flex gap-5 items-center pb-7 border-b border-custom-border-200">
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
<button <button

View File

@ -44,15 +44,15 @@ const WorkspaceIntegrations: NextPage = () => {
link={`/${workspaceSlug}`} link={`/${workspaceSlug}`}
linkTruncate linkTruncate
/> />
<BreadcrumbItem title="Integrations" unshrinkTitle /> <BreadcrumbItem title="Integrations Settings" unshrinkTitle />
</Breadcrumbs> </Breadcrumbs>
} }
> >
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<IntegrationAndImportExportBanner bannerName="Integrations" /> <IntegrationAndImportExportBanner bannerName="Integrations" />
<div> <div>
{appIntegrations ? ( {appIntegrations ? (
@ -60,7 +60,7 @@ const WorkspaceIntegrations: NextPage = () => {
<SingleIntegrationCard key={integration.id} integration={integration} /> <SingleIntegrationCard key={integration.id} integration={integration} />
)) ))
) : ( ) : (
<Loader className="space-y-1"> <Loader className="space-y-2.5 mt-4">
<Loader.Item height="89px" /> <Loader.Item height="89px" />
<Loader.Item height="89px" /> <Loader.Item height="89px" />
</Loader> </Loader>

View File

@ -186,11 +186,11 @@ const MembersSettings: NextPage = () => {
user={user} user={user}
onSuccess={handleInviteModalSuccess} onSuccess={handleInviteModalSuccess}
/> />
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2 h-full">
<div className="w-80 py-8"> <div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar /> <SettingsSidebar />
</div> </div>
<section className="pr-9 py-8 w-full"> <section className="pr-9 py-8 w-full overflow-y-auto">
<div className="flex items-center justify-between gap-4 pt-2 pb-3.5 border-b border-custom-border-200"> <div className="flex items-center justify-between gap-4 pt-2 pb-3.5 border-b border-custom-border-200">
<h4 className="text-xl font-medium">Members</h4> <h4 className="text-xl font-medium">Members</h4>
<PrimaryButton onClick={() => setInviteModal(true)}>Add Member</PrimaryButton> <PrimaryButton onClick={() => setInviteModal(true)}>Add Member</PrimaryButton>