Skip to content

Commit

Permalink
chore: vaults improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Aug 7, 2023
1 parent 0a51034 commit 1585d6b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ListItemVaultInfo: FunctionComponent<Props> = ({ item }) => {
const sharedByContact = application.sharedVaults.getItemSharedBy(item)

return (
<div className="mt-0.5 flex flex-wrap items-center gap-2">
<div className="mt-1 flex flex-wrap items-center gap-2">
<VaultNameBadge vault={vault} />

{sharedByContact && (
Expand Down
11 changes: 10 additions & 1 deletion packages/web/src/javascripts/Components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ type MenuItemProps = {

const MenuItem = forwardRef(
(
{ children, className = '', icon, iconClassName, tabIndex, shortcut, disabled, ...props }: MenuItemProps,
{
children,
className = '',
icon,
iconClassName = 'w-6 h-6 md:w-5 md:h-5 text-neutral mr-2',
tabIndex,
shortcut,
disabled,
...props
}: MenuItemProps,
ref: Ref<HTMLButtonElement>,
) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Icon from '../Icon/Icon'
import { useApplication } from '../ApplicationProvider'
import { DecryptedItemInterface } from '@standardnotes/snjs'
import { featureTrunkVaultsEnabled } from '@/FeatureTrunk'
import VaultNameBadge from '../Vaults/VaultNameBadge'

type Props = {
item: DecryptedItemInterface
Expand All @@ -28,13 +29,10 @@ const CollaborationInfoHUD: FunctionComponent<Props> = ({ item }) => {

return (
<div className="flex flex-wrap items-start gap-2">
<div title="Vault name" className={'flex rounded bg-success px-1.5 py-1 text-success-contrast'}>
<Icon ariaLabel="Shared in vault" type="safe-square" className="mr-1 text-info-contrast" size="medium" />
<span className="mr-auto overflow-hidden text-ellipsis text-xs">{vault.name}</span>
</div>
<VaultNameBadge vault={vault} />

{lastEditedBy && (
<div title="Last edited by" className={'flex rounded bg-info px-1.5 py-1 text-info-contrast'}>
<div title="Last edited by" className="flex rounded bg-info px-1.5 py-1 text-info-contrast select-none">
<Icon ariaLabel="Shared by" type="pencil" className="mr-1 text-info-contrast" size="medium" />
<span className="mr-auto overflow-hidden text-ellipsis text-xs">{lastEditedBy?.name}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const Vaults = () => {
<PreferencesGroup>
<PreferencesSegment>
<Title>Vaults</Title>
<div className="my-2 flex flex-col">
<div className="my-2 flex flex-col gap-3.5">
{vaults.map((vault) => {
return <VaultItem vault={vault} key={vault.uuid} />
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import RadioButtonGroup from '@/Components/RadioButtonGroup/RadioButtonGroup'
import ManyVaultSelectionMenu from './ManyVaultSelectionMenu'
import SingleVaultSelectionMenu from './SingleVaultSelectionMenu'
import { useApplication } from '../ApplicationProvider'
import MenuItemSeparator from '../Menu/MenuItemSeparator'
import MenuItem from '../Menu/MenuItem'

type MenuProps = {
controller: VaultSelectionMenuController
Expand Down Expand Up @@ -41,9 +43,17 @@ const VaultSelectionMenu: FunctionComponent<MenuProps> = () => {
onChange={(value) => changeSelectionMode(value as SettingsMode)}
className="m-3 mt-1"
/>

{mode === 'many' && <ManyVaultSelectionMenu />}
{mode === 'single' && <SingleVaultSelectionMenu />}
<MenuItemSeparator />
<MenuItem
icon="settings"
onClick={() => {
application.preferencesController.openPreferences('vaults')
}}
>
Open vault settings
</MenuItem>
</Menu>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ type Props = {

const VaultNameBadge: FunctionComponent<Props> = ({ vault }) => {
return (
<div className={'rounded bg-success px-1.5 py-1 text-danger-contrast'}>
<span className="flex items-center" title="Vault name">
<Icon ariaLabel="Vault name" type="safe-square" className="mr-1 text-info-contrast" size="medium" />
<div className="text-center text-xs font-bold">{vault.name}</div>
</span>
<div title="Vault name" className="flex rounded bg-success px-1.5 py-1 text-success-contrast select-none">
<Icon ariaLabel="Shared in vault" type="safe-square" className="mr-1 text-info-contrast" size="medium" />
<span className="mr-auto overflow-hidden text-ellipsis text-xs">{vault.name}</span>
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class PreferencesController extends AbstractViewController {
this.currentPane = prefId
}

openPreferences = (): void => {
openPreferences = (prefId?: PreferenceId): void => {
if (prefId) {
this.currentPane = prefId
}
this._open = true
}

Expand Down

0 comments on commit 1585d6b

Please sign in to comment.