forked from github/plane
style: showing 'Created by me' tab to all user (#1739)
* style: showing 'Created by me' tab to all user * refactor: removed unnecessary imports
This commit is contained in:
parent
cb4d294608
commit
92b22dc99e
@ -1,10 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
|
|
||||||
// hooks
|
|
||||||
import useWorkspaceMembers from "hooks/use-workspace-members";
|
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Icon, Tooltip } from "components/ui";
|
import { Icon, Tooltip } from "components/ui";
|
||||||
// helpers
|
// helpers
|
||||||
@ -44,11 +39,6 @@ export const NotificationHeader: React.FC<NotificationHeaderProps> = (props) =>
|
|||||||
setSelectedTab,
|
setSelectedTab,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { workspaceSlug } = router.query;
|
|
||||||
|
|
||||||
const { isOwner, isMember } = useWorkspaceMembers(workspaceSlug?.toString() ?? "");
|
|
||||||
|
|
||||||
const notificationTabs: Array<{
|
const notificationTabs: Array<{
|
||||||
label: string;
|
label: string;
|
||||||
value: NotificationType;
|
value: NotificationType;
|
||||||
@ -150,59 +140,31 @@ export const NotificationHeader: React.FC<NotificationHeaderProps> = (props) =>
|
|||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<nav className="flex space-x-5 overflow-x-auto" aria-label="Tabs">
|
<nav className="flex space-x-5 overflow-x-auto" aria-label="Tabs">
|
||||||
{notificationTabs.map((tab) =>
|
{notificationTabs.map((tab) => (
|
||||||
tab.value === "created" ? (
|
<button
|
||||||
isMember || isOwner ? (
|
type="button"
|
||||||
<button
|
key={tab.value}
|
||||||
type="button"
|
onClick={() => setSelectedTab(tab.value)}
|
||||||
key={tab.value}
|
className={`whitespace-nowrap border-b-2 pb-4 px-1 text-sm font-medium outline-none ${
|
||||||
onClick={() => setSelectedTab(tab.value)}
|
tab.value === selectedTab
|
||||||
className={`whitespace-nowrap border-b-2 pb-4 px-1 text-sm font-medium outline-none ${
|
? "border-custom-primary-100 text-custom-primary-100"
|
||||||
|
: "border-transparent text-custom-text-200"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
{tab.unreadCount && tab.unreadCount > 0 ? (
|
||||||
|
<span
|
||||||
|
className={`ml-2 rounded-full text-xs px-2 py-0.5 ${
|
||||||
tab.value === selectedTab
|
tab.value === selectedTab
|
||||||
? "border-custom-primary-100 text-custom-primary-100"
|
? "bg-custom-primary-100 text-white"
|
||||||
: "border-transparent text-custom-text-200"
|
: "bg-custom-background-80 text-custom-text-200"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{getNumberCount(tab.unreadCount)}
|
||||||
{tab.unreadCount && tab.unreadCount > 0 ? (
|
</span>
|
||||||
<span
|
) : null}
|
||||||
className={`ml-2 rounded-full text-xs px-2 py-0.5 ${
|
</button>
|
||||||
tab.value === selectedTab
|
))}
|
||||||
? "bg-custom-primary-100 text-white"
|
|
||||||
: "bg-custom-background-80 text-custom-text-200"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{getNumberCount(tab.unreadCount)}
|
|
||||||
</span>
|
|
||||||
) : null}
|
|
||||||
</button>
|
|
||||||
) : null
|
|
||||||
) : (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
key={tab.value}
|
|
||||||
onClick={() => setSelectedTab(tab.value)}
|
|
||||||
className={`whitespace-nowrap border-b-2 pb-4 px-1 text-sm font-medium ${
|
|
||||||
tab.value === selectedTab
|
|
||||||
? "border-custom-primary-100 text-custom-primary-100"
|
|
||||||
: "border-transparent text-custom-text-200"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{tab.label}
|
|
||||||
{tab.unreadCount && tab.unreadCount > 0 ? (
|
|
||||||
<span
|
|
||||||
className={`ml-2 rounded-full text-xs px-2 py-0.5 ${
|
|
||||||
tab.value === selectedTab
|
|
||||||
? "bg-custom-primary-100 text-white"
|
|
||||||
: "bg-custom-background-80 text-custom-text-200"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{getNumberCount(tab.unreadCount)}
|
|
||||||
</span>
|
|
||||||
) : null}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</nav>
|
</nav>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user