Skip to content

Commit

Permalink
feat(platform): Add new access level SVGs and integrate into ProjectC…
Browse files Browse the repository at this point in the history
…ard component (#678)

Co-authored-by: Rajdip Bhattacharya <[email protected]>
  • Loading branch information
kriptonian1 and rajdip-b authored Jan 30, 2025
1 parent 6c7e41a commit cc3ef77
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 5 deletions.
7 changes: 7 additions & 0 deletions apps/platform/public/svg/dashboard/global.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion apps/platform/public/svg/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,16 @@ import EnvironmentSVG from './environment.svg'
import SecretSVG from './secret.svg'
import FolderSVG from './folder.svg'
import VariableSVG from './variable.svg'
import PrivateSVG from './private.svg'
import GlobalSVG from './global.svg'
import InternalSVG from './internal.svg'

export { EnvironmentSVG, SecretSVG, FolderSVG, VariableSVG }
export {
EnvironmentSVG,
SecretSVG,
FolderSVG,
VariableSVG,
PrivateSVG,
GlobalSVG,
InternalSVG
}
5 changes: 5 additions & 0 deletions apps/platform/public/svg/dashboard/internal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/platform/public/svg/dashboard/private.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import Link from 'next/link'
import { toast } from 'sonner'
import Avvvatars from 'avvvatars-react'
import { SecretSVG, EnvironmentSVG, VariableSVG } from '@public/svg/dashboard'
import {
SecretSVG,
EnvironmentSVG,
VariableSVG,
GlobalSVG,
PrivateSVG,
InternalSVG
} from '@public/svg/dashboard'
import type { ProjectWithCount } from '@keyshade/schema'
import { useSetAtom } from 'jotai'
import {
Expand Down Expand Up @@ -32,7 +39,8 @@ export default function ProjectCard({
description,
environmentCount,
secretCount,
variableCount
variableCount,
accessLevel
} = project

const setIsEditProjectSheetOpen = useSetAtom(editProjectOpenAtom)
Expand Down Expand Up @@ -76,6 +84,19 @@ export default function ProjectCard({
setIsDeleteProjectOpen(true)
}

const accessLevelToSVG = (accessLvl: ProjectWithCount['accessLevel']) => {
switch (accessLvl) {
case 'GLOBAL':
return <GlobalSVG width={16} />
case 'PRIVATE':
return <PrivateSVG width={16} />
case 'INTERNAL':
return <InternalSVG width={16} />
default:
return null
}
}

return (
<ContextMenu>
<ContextMenuTrigger className="flex h-[7rem]">
Expand All @@ -85,7 +106,6 @@ export default function ProjectCard({
key={id}
>
<div className="flex items-center gap-x-5">
{/* <div className="aspect-square h-14 w-14 rounded-full bg-white/35" /> */}
<Avvvatars size={56} style="shape" value={id} />
<div>
<div className="font-semibold">{name}</div>
Expand All @@ -94,7 +114,11 @@ export default function ProjectCard({
</span>
</div>
</div>
<div className="flex h-full flex-col items-end justify-end">
<div className="flex h-full flex-col items-end justify-between">
<div className="flex items-center gap-1 rounded-md border border-white/70 px-2 py-1 capitalize">
{accessLevelToSVG(accessLevel)}
{accessLevel.toLowerCase()}
</div>
<div className="grid grid-cols-3 gap-x-3">
<div className="flex items-center gap-x-1">
<EnvironmentSVG width={16} />
Expand Down

0 comments on commit cc3ef77

Please sign in to comment.