-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chat): add permission card avatars
- Loading branch information
Showing
14 changed files
with
135 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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
17 changes: 17 additions & 0 deletions
17
apps/chat/src/modules/permissions/card/card-record-permissions.tsx
This file contains 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,17 @@ | ||
import { isSdkPublicPermissions, type SdkPermissionT } from '@llm/sdk'; | ||
|
||
import { CardRecordPublic } from './card-record-public'; | ||
import { CardRecordSharedWith } from './card-record-shared-with'; | ||
|
||
type Props = { | ||
permissions: SdkPermissionT[]; | ||
className?: string; | ||
}; | ||
|
||
export function CardRecordPermissions({ permissions, ...props }: Props) { | ||
if (isSdkPublicPermissions(permissions)) { | ||
return <CardRecordPublic permissions={permissions} {...props} />; | ||
} | ||
|
||
return <CardRecordSharedWith permissions={permissions} {...props} />; | ||
} |
26 changes: 26 additions & 0 deletions
26
apps/chat/src/modules/permissions/card/card-record-public.tsx
This file contains 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,26 @@ | ||
import clsx from 'clsx'; | ||
import { GlobeIcon } from 'lucide-react'; | ||
|
||
import type { SdkPermissionT } from '@llm/sdk'; | ||
|
||
import { useI18n } from '~/i18n'; | ||
|
||
type Props = { | ||
permissions: SdkPermissionT[]; | ||
className?: string; | ||
}; | ||
|
||
export function CardRecordPublic({ className }: Props) { | ||
const t = useI18n().pack.permissions.status; | ||
|
||
return ( | ||
<div className={clsx('flex items-center gap-2', className)}> | ||
<div className="flex items-center gap-1.5 text-gray-500"> | ||
<GlobeIcon size={16} /> | ||
<span className="text-sm"> | ||
{t.publicTooltip} | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/chat/src/modules/permissions/card/card-record-shared-with.tsx
This file contains 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,31 @@ | ||
import clsx from 'clsx'; | ||
import { UsersIcon } from 'lucide-react'; | ||
|
||
import type { SdkPermissionT } from '@llm/sdk'; | ||
|
||
import { useI18n } from '~/i18n'; | ||
|
||
import { PermissionAvatarsList } from '../list/permission-avatars-list'; | ||
|
||
type Props = { | ||
permissions: SdkPermissionT[]; | ||
className?: string; | ||
}; | ||
|
||
export function CardRecordSharedWith({ permissions, className }: Props) { | ||
const t = useI18n().pack.permissions.card; | ||
|
||
return ( | ||
<div className={clsx('flex items-center gap-2', className)}> | ||
<div className="flex items-center gap-1.5 text-gray-500"> | ||
<UsersIcon size={16} /> | ||
<span className="text-sm"> | ||
{t.sharedWith} | ||
: | ||
</span> | ||
</div> | ||
|
||
<PermissionAvatarsList permissions={permissions} size="xs" /> | ||
</div> | ||
); | ||
} |
This file contains 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,3 @@ | ||
export * from './card-record-permissions'; | ||
export * from './card-record-public'; | ||
export * from './card-record-shared-with'; |
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './card'; | ||
export * from './controls'; | ||
export * from './list'; | ||
export * from './share-resource'; | ||
|
This file contains 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 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 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 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 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 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 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