diff --git a/pkg/interface/src/views/landscape/components/GroupifyForm.tsx b/pkg/interface/src/views/landscape/components/GroupifyForm.tsx index e7769b9209..9690fd20cc 100644 --- a/pkg/interface/src/views/landscape/components/GroupifyForm.tsx +++ b/pkg/interface/src/views/landscape/components/GroupifyForm.tsx @@ -36,7 +36,7 @@ export function GroupifyForm(props: GroupifyFormProps) { name, values.group?.toString() || undefined )); - let mod = association['app-name']; + let mod: string = association['app-name']; if (association?.metadata?.config && 'graph' in association.metadata.config) { mod = association.metadata.config.graph as AppName; } diff --git a/pkg/interface/src/views/landscape/components/Resource.tsx b/pkg/interface/src/views/landscape/components/Resource.tsx index 59f3149c72..eb32cb6740 100644 --- a/pkg/interface/src/views/landscape/components/Resource.tsx +++ b/pkg/interface/src/views/landscape/components/Resource.tsx @@ -26,7 +26,7 @@ export function Resource(props: ResourceProps): ReactElement { const notificationsCount = useHarkState(state => state.notificationsCount); const associations = useMetadataState(state => state.associations); const contacts = useContactState(state => state.contacts); - let app = association['app-name']; + let app: string = association['app-name']; if (association?.metadata?.config && 'graph' in association.metadata.config) { app = association.metadata.config.graph as AppName; } diff --git a/pkg/interface/src/views/landscape/components/ResourceSkeleton.tsx b/pkg/interface/src/views/landscape/components/ResourceSkeleton.tsx index 1cfc82eb2b..1429e02bc4 100644 --- a/pkg/interface/src/views/landscape/components/ResourceSkeleton.tsx +++ b/pkg/interface/src/views/landscape/components/ResourceSkeleton.tsx @@ -65,7 +65,7 @@ type ResourceSkeletonProps = { export function ResourceSkeleton(props: ResourceSkeletonProps): ReactElement { const { association, baseUrl, children } = props; - let app = association['app-name']; + let app: string = association['app-name']; if (association?.metadata?.config && 'graph' in association.metadata.config) { app = association.metadata.config.graph as AppName; } diff --git a/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx b/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx index 91be6a0648..d50417d6e6 100644 --- a/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx +++ b/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx @@ -2,7 +2,7 @@ import _ from 'lodash'; import React, { useRef, ReactNode } from 'react'; import urbitOb from 'urbit-ob'; import { Icon, Row, Box, Text, BaseImage } from '@tlon/indigo-react'; -import { Association, cite, AppName } from '@urbit/api'; +import { Association, cite } from '@urbit/api'; import { HoverBoxLink } from '~/views/components/HoverBox'; import { Sigil } from '~/logic/lib/sigil'; import { useTutorialModal } from '~/views/components/useTutorialModal'; @@ -176,9 +176,9 @@ export const SidebarAssociationItem = React.memo((props: { const { association, selected } = props; const title = getItemTitle(association) || ''; const appName = association?.['app-name']; - let mod = appName; + let mod: string = appName; if (association?.metadata?.config && 'graph' in association.metadata.config) { - mod = association.metadata.config.graph as AppName; + mod = association.metadata.config.graph ; } const rid = association?.resource; const groupPath = association?.group; diff --git a/pkg/npm/api/metadata/lib.ts b/pkg/npm/api/metadata/lib.ts index 2d98a76af9..ace81e8a31 100644 --- a/pkg/npm/api/metadata/lib.ts +++ b/pkg/npm/api/metadata/lib.ts @@ -1,5 +1,5 @@ -import { AppName, Path, Poke, uxToHex, PatpNoSig } from '../lib'; -import { Association, Metadata, MetadataUpdate, MetadataUpdateAdd, MetadataUpdateRemove, MetadataEditField, MetadataUpdateEdit } from './types'; +import { Path, Poke, uxToHex, PatpNoSig } from '../lib'; +import { MdAppName, Association, Metadata, MetadataUpdate, MetadataUpdateAdd, MetadataUpdateRemove, MetadataEditField, MetadataUpdateEdit } from './types'; export const METADATA_UPDATE_VERSION = 2; @@ -11,7 +11,7 @@ export const metadataAction = (data: T, version: numbe export const add = ( ship: PatpNoSig, - appName: AppName, + appName: MdAppName, resource: Path, group: Path, title: string, @@ -44,10 +44,10 @@ export const add = ( export { add as metadataAdd }; export const remove = ( - appName: AppName, + appName: MdAppName, resource: string, group: string -): Poke => metadataAction({ +): Poke => metadataAction({ remove: { group, resource: { @@ -62,7 +62,7 @@ export { remove as metadataRemove }; export const edit = ( association: Association, edit: MetadataEditField -): Poke => metadataAction({ +): Poke => metadataAction({ edit: { group: association.group, resource: { @@ -84,7 +84,7 @@ export const update = ( ): Poke => { const metadata = { ...association.metadata, ...newMetadata }; metadata.color = uxToHex(metadata.color); - return metadataAction({ + return metadataAction({ add: { group: association.group, resource: { diff --git a/pkg/npm/api/metadata/types.ts b/pkg/npm/api/metadata/types.ts index b024bef724..828c83b1f6 100644 --- a/pkg/npm/api/metadata/types.ts +++ b/pkg/npm/api/metadata/types.ts @@ -1,5 +1,7 @@ import { Path, Patp } from '../lib'; +export type MdAppName = 'groups' | 'graph'; + export type MetadataUpdate = MetadataUpdateInitial | MetadataUpdateAdd @@ -26,6 +28,7 @@ export type MetadataUpdateUpdate = { export interface MetadataUpdateEdit { edit: { resource: MdResource; + group: string; edit: MetadataEditField; } } @@ -41,7 +44,7 @@ export type MetadataUpdateRemove = { export interface MdResource { resource: string; - 'app-name': 'groups' | 'graph'; + 'app-name': MdAppName; } export interface MetadataUpdatePreview {