Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workspaces list not being fetched, display properties endpoint updated #2493

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions web/components/workspace/sidebar-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { Avatar } from "components/ui";
import { Loader } from "@plane/ui";
// icons
import { Check, LogOut, Plus, Settings, UserCircle2 } from "lucide-react";
// helpers
import { truncateText } from "helpers/string.helper";
// types
import { IWorkspace } from "types";

Expand Down Expand Up @@ -104,15 +102,15 @@ export const WorkspaceSidebarDropdown = observer(() => {
};

return (
<div className="inline-flex items-center gap-2 px-4 pt-4">
<Menu as="div" className="relative col-span-4 inline-block w-full text-left">
<Menu.Button className="text-custom-sidebar-text-200 flex w-full items-center rounded-sm text-sm font-medium focus:outline-none">
<div className="flex items-center gap-2 px-4 pt-4">
<Menu as="div" className="relative col-span-4 text-left flex-grow truncate">
<Menu.Button className="text-custom-sidebar-text-200 rounded-sm text-sm font-medium focus:outline-none w-full truncate">
<div
className={`flex w-full items-center gap-x-2 rounded-sm bg-custom-sidebar-background-80 p-1 ${
className={`flex items-center gap-x-2 rounded-sm bg-custom-sidebar-background-80 p-1 truncate ${
themeStore.sidebarCollapsed ? "justify-center" : ""
}`}
>
<div className="relative grid h-6 w-6 place-items-center rounded bg-gray-700 uppercase text-white">
<div className="relative grid h-6 w-6 place-items-center rounded bg-gray-700 uppercase text-white flex-shrink-0">
{activeWorkspace?.logo && activeWorkspace.logo !== "" ? (
<img
src={activeWorkspace.logo}
Expand All @@ -125,8 +123,8 @@ export const WorkspaceSidebarDropdown = observer(() => {
</div>

{!themeStore.sidebarCollapsed && (
<h4 className="text-custom-text-100">
{activeWorkspace?.name ? truncateText(activeWorkspace.name, 14) : "Loading..."}
<h4 className="text-custom-text-100 truncate">
{activeWorkspace?.name ? activeWorkspace.name : "Loading..."}
</h4>
)}
</div>
Expand Down Expand Up @@ -158,8 +156,8 @@ export const WorkspaceSidebarDropdown = observer(() => {
onClick={() => handleWorkspaceNavigation(workspace)}
className="flex w-full items-center justify-between gap-1 p-1 rounded-md text-sm text-custom-sidebar-text-100 hover:bg-custom-sidebar-background-80"
>
<div className="flex items-center justify-start gap-2.5">
<span className="relative flex h-6 w-6 items-center justify-center rounded bg-gray-700 p-2 text-xs uppercase text-white">
<div className="flex items-center justify-start gap-2.5 truncate">
<span className="relative flex h-6 w-6 items-center justify-center rounded bg-gray-700 p-2 text-xs uppercase text-white flex-shrink-0">
{workspace?.logo && workspace.logo !== "" ? (
<img
src={workspace.logo}
Expand All @@ -172,18 +170,18 @@ export const WorkspaceSidebarDropdown = observer(() => {
</span>

<h5
className={`text-sm ${workspaceSlug === workspace.slug ? "" : "text-custom-text-200"}`}
className={`text-sm truncate ${
workspaceSlug === workspace.slug ? "" : "text-custom-text-200"
}`}
>
{truncateText(workspace.name, 18)}
{workspace.name}
</h5>
</div>
<span className="p-1">
<Check
className={`h-3 w-3.5 text-custom-sidebar-text-100 ${
workspace.id === activeWorkspace?.id ? "opacity-100" : "opacity-0"
}`}
/>
</span>
{workspace.id === activeWorkspace?.id && (
<span className="p-1 flex-shrink-0">
<Check className="h-3 w-3.5 text-custom-sidebar-text-100" />
</span>
)}
</button>
)}
</Menu.Item>
Expand Down
2 changes: 2 additions & 0 deletions web/layouts/auth-layout/workspace-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
// router
const router = useRouter();
const { workspaceSlug } = router.query;
// fetching all workspaces
useSWR(`USER_WORKSPACES_LIST`, () => workspaceStore.fetchWorkspaces());
// fetching user workspace information
useSWR(
workspaceSlug ? `WORKSPACE_MEMBERS_ME_${workspaceSlug}` : null,
Expand Down
6 changes: 4 additions & 2 deletions web/services/issue/issue.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ export class IssueService extends APIService {
});
}

async patchIssueDisplayProperties(
async updateIssueDisplayProperties(
workspaceSlug: string,
projectId: string,
data: IIssueDisplayProperties
): Promise<any> {
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`, data)
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`, {
properties: data,
})
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
Expand Down
4 changes: 2 additions & 2 deletions web/store/issue/issue_filters.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ export class IssueFilterStore implements IIssueFilterStore {
this.userDisplayProperties = newProperties;
});

await this.issueService.patchIssueDisplayProperties(workspaceSlug, projectId, newProperties);
await this.issueService.updateIssueDisplayProperties(workspaceSlug, projectId, newProperties);
} catch (error) {
this.fetchUserProjectFilters(workspaceSlug, projectId);

runInAction(() => {
this.error = error;
});

console.log("Failed to update user filters in issue filter store", error);
console.log("Failed to update user display properties in issue filter store", error);
}
};
}
Loading