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>
) : (
<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">

View File

@ -129,7 +129,7 @@ const IntegrationGuide = () => {
</button>
</h3>
</div>
<div className="flex flex-col px-4 py-6">
<div className="flex flex-col">
{importerServices ? (
importerServices.length > 0 ? (
<div className="space-y-2">
@ -145,7 +145,7 @@ const IntegrationGuide = () => {
</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.
</p>
)

View File

@ -8,6 +8,8 @@ import useSWR from "swr";
import projectService from "services/project.service";
// ui
import { Avatar, CustomSearchSelect } from "components/ui";
// icon
import { Ban } from "lucide-react";
// fetch-keys
import { PROJECT_MEMBERS } from "constants/fetch-keys";
@ -49,7 +51,10 @@ export const MemberSelect: React.FC<Props> = ({ value, onChange }) => {
{selectedOption ? (
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>
}
@ -61,7 +66,12 @@ export const MemberSelect: React.FC<Props> = ({ value, onChange }) => {
{
value: "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 Link from "next/link";
type Props = {
profilePage?: boolean;
};
export const SettingsSidebar: React.FC<Props> = ({ profilePage = false }) => {
export const SettingsSidebar = () => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;

View File

@ -38,13 +38,13 @@ const ProfileActivity = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</div>
{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">
<h3 className="text-xl font-medium">Acitivity</h3>
</div>
@ -168,7 +168,7 @@ const ProfileActivity = () => {
/>
) : (
<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)}
</div>

View File

@ -167,11 +167,11 @@ const Profile: NextPage = () => {
/>
{myProfile ? (
<form onSubmit={handleSubmit(onSubmit)}>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<img
src={

View File

@ -59,12 +59,12 @@ const ProfilePreferences = observer(() => {
}
>
{myProfile ? (
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Acitivity</h3>
</div>

View File

@ -75,11 +75,11 @@ const AutomationsSettings: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Automations</h3>
</div>

View File

@ -125,11 +125,11 @@ const EstimatesSettings: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2 h-full overflow-hidden">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Estimates</h3>
<div className="col-span-12 space-y-5 sm:col-span-7">

View File

@ -153,11 +153,11 @@ const FeaturesSettings: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Features</h3>
</div>

View File

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

View File

@ -54,18 +54,20 @@ const ProjectIntegrations: NextPage = () => {
link={`/${workspaceSlug}/projects/${projectId}/issues`}
linkTruncate
/>
<BreadcrumbItem title="Integrations" unshrinkTitle />
<BreadcrumbItem title="Integrations Settings" unshrinkTitle />
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2 h-full overflow-hidden">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</div>
<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">
<h3 className="text-xl font-medium">Integrations</h3>
</div>
{workspaceIntegrations ? (
workspaceIntegrations.length > 0 ? (
<section className="pr-9 py-8 overflow-y-auto w-full">
<IntegrationAndImportExportBanner bannerName="Integrations" />
<div>
{workspaceIntegrations.map((integration) => (
<SingleIntegration
@ -74,7 +76,6 @@ const ProjectIntegrations: NextPage = () => {
/>
))}
</div>
</section>
) : (
<EmptyState
title="You haven't configured integrations"
@ -95,6 +96,7 @@ const ProjectIntegrations: NextPage = () => {
</Loader>
)}
</div>
</div>
</ProjectAuthorizationWrapper>
);
};

View File

@ -113,11 +113,11 @@ const LabelsSettings: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2 h-full w-full">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Labels</h3>

View File

@ -273,11 +273,11 @@ const MembersSettings: NextPage = () => {
user={user}
onSuccess={() => mutateMembers()}
/>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Defaults</h3>
</div>

View File

@ -73,11 +73,11 @@ const StatesSettings: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">States</h3>
</div>

View File

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

View File

@ -40,11 +40,11 @@ const ImportExport: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Exports</h3>
</div>

View File

@ -40,18 +40,15 @@ const ImportExport: NextPage = () => {
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2 h-full overflow-hidden">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h3 className="text-xl font-medium">Imports</h3>
</div>
<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>
</div>
</WorkspaceAuthorizationLayout>

View File

@ -183,12 +183,12 @@ const WorkspaceSettings: NextPage = () => {
data={activeWorkspace ?? null}
user={user}
/>
<div className="flex flex-row gap-2 h-full w-full">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</div>
{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 flex-col gap-1">
<button

View File

@ -44,15 +44,15 @@ const WorkspaceIntegrations: NextPage = () => {
link={`/${workspaceSlug}`}
linkTruncate
/>
<BreadcrumbItem title="Integrations" unshrinkTitle />
<BreadcrumbItem title="Integrations Settings" unshrinkTitle />
</Breadcrumbs>
}
>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</div>
<section className="pr-9 py-8 w-full">
<section className="pr-9 py-8 w-full overflow-y-auto">
<IntegrationAndImportExportBanner bannerName="Integrations" />
<div>
{appIntegrations ? (
@ -60,7 +60,7 @@ const WorkspaceIntegrations: NextPage = () => {
<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>

View File

@ -186,11 +186,11 @@ const MembersSettings: NextPage = () => {
user={user}
onSuccess={handleInviteModalSuccess}
/>
<div className="flex flex-row gap-2">
<div className="w-80 py-8">
<div className="flex flex-row gap-2 h-full">
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
<SettingsSidebar />
</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">
<h4 className="text-xl font-medium">Members</h4>
<PrimaryButton onClick={() => setInviteModal(true)}>Add Member</PrimaryButton>