internal: incomplete vault systems behind feature flag (#2340)

This commit is contained in:
Mo
2023-06-30 09:01:56 -05:00
committed by GitHub
parent d16e401bb9
commit b032eb9c9b
638 changed files with 20321 additions and 4813 deletions

View File

@@ -13,6 +13,7 @@ import { getIconForFileType } from '@/Utils/Items/Icons/getIconForFileType'
import { useApplication } from '../ApplicationProvider'
import { PaneLayout } from '@/Controllers/PaneController/PaneLayout'
import ListItemFlagIcons from './ListItemFlagIcons'
import ListItemVaultInfo from './ListItemVaultInfo'
const FileListItemCard: FunctionComponent<DisplayableListItemProps<FileItem>> = ({
filesController,
@@ -103,6 +104,7 @@ const FileListItemCard: FunctionComponent<DisplayableListItemProps<FileItem>> =
<ListItemMetadata item={file} hideDate={hideDate} sortBy={sortBy} />
<ListItemTags hideTags={hideTags} tags={tags} />
<ListItemConflictIndicator item={file} />
<ListItemVaultInfo item={file} />
</div>
<ListItemFlagIcons className="p-4" item={file} isFileBackedUp={!!backupInfo} />
</div>

View File

@@ -14,6 +14,7 @@ import { getIconForFileType } from '@/Utils/Items/Icons/getIconForFileType'
import { useApplication } from '../ApplicationProvider'
import Icon from '../Icon/Icon'
import { PaneLayout } from '@/Controllers/PaneController/PaneLayout'
import ListItemVaultInfo from './ListItemVaultInfo'
const FileListItemCard: FunctionComponent<DisplayableListItemProps<FileItem>> = ({
filesController,
@@ -106,6 +107,7 @@ const FileListItemCard: FunctionComponent<DisplayableListItemProps<FileItem>> =
<ListItemMetadata item={file} hideDate={hideDate} sortBy={sortBy} />
<ListItemTags hideTags={hideTags} tags={tags} />
<ListItemConflictIndicator item={file} />
<ListItemVaultInfo item={file} />
</div>
</div>
<div

View File

@@ -14,6 +14,7 @@ import { FilesController } from '@/Controllers/FilesController'
import SearchButton from './SearchButton'
import { ItemListController } from '@/Controllers/ItemList/ItemListController'
import { PaneController } from '@/Controllers/PaneController/PaneController'
import ListItemVaultInfo from '../ListItemVaultInfo'
type Props = {
application: WebApplication
@@ -162,15 +163,16 @@ const ContentListHeader = ({
)}
/>
)}
<div className="flex min-w-0 flex-grow flex-col break-words">
<div className="mr-2 flex min-w-0 flex-col break-words">
<div className="text-2xl font-semibold text-text md:text-lg">{panelTitle}</div>
{showSyncSubtitle && <div className="-mt-1 text-xs text-passive-0 md:mt-0">{syncSubtitle}</div>}
{optionsSubtitle && <div className="text-xs text-passive-0">{optionsSubtitle}</div>}
</div>
<ListItemVaultInfo item={selectedTag} />
</div>
</div>
)
}, [optionsSubtitle, showSyncSubtitle, icon, panelTitle, syncSubtitle])
}, [optionsSubtitle, selectedTag, showSyncSubtitle, icon, panelTitle, syncSubtitle])
const PhoneAndDesktopLayout = useMemo(() => {
return (

View File

@@ -181,7 +181,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
} else if (isSystemTag) {
await changeSystemViewPreferences(properties)
} else {
await application.mutator.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
await application.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
mutator.preferences = {
...mutator.preferences,
...properties,
@@ -189,7 +189,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
})
}
},
[currentMode, isSystemTag, changeGlobalPreferences, changeSystemViewPreferences, application.mutator, selectedTag],
[currentMode, isSystemTag, changeGlobalPreferences, changeSystemViewPreferences, application, selectedTag],
)
const resetTagPreferences = useCallback(async () => {
@@ -202,7 +202,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
return
}
void application.mutator.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
void application.changeAndSaveItem<TagMutator>(selectedTag, (mutator) => {
mutator.preferences = undefined
})
}, [application, isSystemTag, reloadPreferences, selectedTag])

View File

@@ -0,0 +1,46 @@
import { FunctionComponent } from 'react'
import { useApplication } from '../ApplicationProvider'
import Icon from '../Icon/Icon'
import { DecryptedItemInterface } from '@standardnotes/snjs'
import VaultNameBadge from '../Vaults/VaultNameBadge'
import { featureTrunkVaultsEnabled } from '@/FeatureTrunk'
type Props = {
item: DecryptedItemInterface
}
const ListItemVaultInfo: FunctionComponent<Props> = ({ item }) => {
const application = useApplication()
if (!featureTrunkVaultsEnabled()) {
return null
}
if (application.items.isTemplateItem(item)) {
return null
}
const vault = application.vaults.getItemVault(item)
if (!vault) {
return null
}
const sharedByContact = application.sharedVaults.getItemSharedBy(item)
return (
<div className="mt-0.5 flex flex-wrap items-center gap-2">
<VaultNameBadge vault={vault} />
{sharedByContact && (
<div title="Shared by contact" className={'mt-2 rounded bg-info py-1 px-1.5 text-neutral-contrast'}>
<span className="flex items-center" title="Shared by contact">
<Icon ariaLabel="Shared by contact" type="archive" className="mr-1 text-info-contrast" size="medium" />
<div className="text-center text-xs font-bold">{sharedByContact?.name}</div>
</span>
</div>
)}
</div>
)
}
export default ListItemVaultInfo

View File

@@ -13,6 +13,7 @@ import { ListItemTitle } from './ListItemTitle'
import { log, LoggingDomain } from '@/Logging'
import { classNames } from '@standardnotes/utils'
import { getIconAndTintForNoteType } from '@/Utils/Items/Icons/getIconAndTintForNoteType'
import ListItemVaultInfo from './ListItemVaultInfo'
import { NoteDragDataFormat } from '../Tags/DragNDrop'
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
@@ -143,6 +144,7 @@ const NoteListItem: FunctionComponent<DisplayableListItemProps<SNNote>> = ({
<ListItemMetadata item={item} hideDate={hideDate} sortBy={sortBy} />
<ListItemTags hideTags={hideTags} tags={tags} />
<ListItemConflictIndicator item={item} />
<ListItemVaultInfo item={item} />
</div>
<ListItemFlagIcons className="p-4" item={item} hasFiles={hasFiles} hasBorder={hasOffsetBorder} />
</div>