-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[WEB-3292] feat: workspace switcher redesign #6543
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4c57ae2
feat: ui changes for workspace switcher
gakshita a60079f
fix: hover
gakshita 4634ca9
fix: added current plan
gakshita 4c4d9e0
feat: Return user role
sangeethailango c4b4caf
chore: remove unused imports
sangeethailango 3e90e8f
fix: css
gakshita 8623bea
Merge pull request #6547 from makeplane/feat-users-workspace-api-modi…
sangeethailango bb1210f
fix: added user role in workspace switcher
gakshita ba61f96
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
gakshita 09c6323
fix: return role as integer
sangeethailango a4b49e9
fix: role casing
gakshita 8d26d7e
fix: refactor
gakshita 666c180
fix: plan pill fix
gakshita 59ac4f2
fix: design updates
gakshita 0faa184
fix: refactor
gakshita 84c10d6
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
gakshita e74c57d
fix: member translation
gakshita bde4d43
fix: css improvements
gakshita 93c0453
fix: truncate issue
gakshita b03673b
fix: workspace switcher dropdown email truncate
anmolsinghbhatia 4211709
fix: workspace switcher dropdown email truncate
anmolsinghbhatia 795095b
fix: role
gakshita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IWorkspace } from "@plane/types"; | ||
|
||
type TProps = { | ||
workspace: IWorkspace; | ||
}; | ||
|
||
export const SubscriptionPill = (props: TProps) => <></>; |
106 changes: 106 additions & 0 deletions
106
web/core/components/workspace/sidebar/dropdown-item.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import Link from "next/link"; | ||
import { useParams } from "next/navigation"; | ||
import { Check, Settings, UserPlus } from "lucide-react"; | ||
import { Menu } from "@headlessui/react"; | ||
import { EUserPermissions } from "@plane/constants"; | ||
import { useTranslation } from "@plane/i18n"; | ||
import { IWorkspace } from "@plane/types"; | ||
import { cn, getFileURL } from "@plane/utils"; | ||
import { getUserRole } from "@/helpers/user.helper"; | ||
import { SubscriptionPill } from "@/plane-web/components/common/subscription-pill"; | ||
|
||
type TProps = { | ||
workspace: IWorkspace; | ||
activeWorkspace: IWorkspace | null; | ||
handleItemClick: () => void; | ||
handleWorkspaceNavigation: (workspace: IWorkspace) => void; | ||
}; | ||
const SidebarDropdownItem = (props: TProps) => { | ||
const { workspace, activeWorkspace, handleItemClick, handleWorkspaceNavigation } = props; | ||
|
||
// router params | ||
const { workspaceSlug } = useParams(); | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Link | ||
key={workspace.id} | ||
href={`/${workspace.slug}`} | ||
onClick={() => { | ||
handleWorkspaceNavigation(workspace); | ||
handleItemClick(); | ||
}} | ||
className="w-full" | ||
id={workspace.id} | ||
> | ||
<Menu.Item | ||
as="div" | ||
className={cn("px-4 py-2", { | ||
"bg-custom-sidebar-background-90": workspace.id === activeWorkspace?.id, | ||
"hover:bg-custom-sidebar-background-90": workspace.id !== activeWorkspace?.id, | ||
})} | ||
> | ||
<div className="flex items-center justify-between gap-1 rounded p-1 text-sm text-custom-sidebar-text-100 "> | ||
<div className="flex items-center justify-start gap-2.5 w-[80%] relative"> | ||
<span | ||
className={`relative flex h-8 w-8 flex-shrink-0 items-center justify-center p-2 text-sm uppercase font-semibold ${ | ||
!workspace?.logo_url && "rounded-lg bg-custom-primary-500 text-white" | ||
}`} | ||
> | ||
{workspace?.logo_url && workspace.logo_url !== "" ? ( | ||
<img | ||
src={getFileURL(workspace.logo_url)} | ||
className="absolute left-0 top-0 h-full w-full rounded-lg object-cover" | ||
alt={t("workspace_logo")} | ||
/> | ||
) : ( | ||
(workspace?.name?.[0] ?? "...") | ||
)} | ||
</span> | ||
<div className="w-[inherit]"> | ||
<div | ||
className={`truncate text-ellipsis text-sm font-medium ${workspaceSlug === workspace.slug ? "" : "text-custom-text-200"}`} | ||
> | ||
{workspace.name} | ||
</div> | ||
<div className="text-sm text-custom-text-300 flex gap-2 capitalize w-fit"> | ||
<span>{getUserRole(workspace.role)?.toLowerCase() || "guest"}</span> | ||
<div className="w-1 h-1 bg-custom-text-300/50 rounded-full m-auto" /> | ||
<span className="capitalize">{t("member", { count: workspace.total_members || 0 })}</span> | ||
</div> | ||
</div> | ||
</div> | ||
{workspace.id === activeWorkspace?.id ? ( | ||
<span className="flex-shrink-0 p-1"> | ||
<Check className="h-5 w-5 text-custom-sidebar-text-100" /> | ||
</span> | ||
) : ( | ||
<SubscriptionPill workspace={workspace} /> | ||
)} | ||
</div> | ||
{workspace.id === activeWorkspace?.id && ( | ||
<div className="mt-2 mb-1 flex gap-2"> | ||
sriramveeraghanta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{workspace?.role > EUserPermissions.GUEST && ( | ||
<Link | ||
href={`/${workspace.slug}/settings`} | ||
className="flex border border-custom-border-200 rounded-md py-1 px-2 gap-1 bg-custom-sidebar-background-100" | ||
> | ||
<Settings className="h-4 w-4 text-custom-sidebar-text-100 my-auto" /> | ||
<span className="text-sm font-medium my-auto">{t("settings")}</span> | ||
</Link> | ||
)} | ||
<Link | ||
href={`/${workspace.slug}/settings/members`} | ||
className="flex border border-custom-border-200 rounded-md py-1 px-2 gap-1 bg-custom-sidebar-background-100" | ||
> | ||
<UserPlus className="h-4 w-4 text-custom-sidebar-text-100 my-auto" /> | ||
<span className="text-sm font-medium my-auto capitalize">{t("invite")}</span> | ||
</Link> | ||
</div> | ||
)} | ||
</Menu.Item> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default SidebarDropdownItem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "ce/components/common/subscription-pill"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.