diff --git a/ui/src/gear/index.ts b/ui/src/gear/index.ts index 50825f78..d3b8aea0 100644 --- a/ui/src/gear/index.ts +++ b/ui/src/gear/index.ts @@ -4,11 +4,6 @@ export * from './groups'; export * as groups from './groups'; export * from './hark'; export * as hark from './hark'; -export * from './invite'; -// this conflicts with /groups/lib invite -// export * as invite from './invite'; -export * from './metadata'; -export * as metadata from './metadata'; export * from './settings'; export * as settings from './settings'; export * from './storage'; diff --git a/ui/src/gear/invite/index.ts b/ui/src/gear/invite/index.ts deleted file mode 100644 index 341e8171..00000000 --- a/ui/src/gear/invite/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './types'; -export * from './lib'; \ No newline at end of file diff --git a/ui/src/gear/invite/lib.ts b/ui/src/gear/invite/lib.ts deleted file mode 100644 index 885ef787..00000000 --- a/ui/src/gear/invite/lib.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Poke } from '@urbit/js-http-api'; -import { Serial } from '@/gear'; -import { InviteUpdate, InviteUpdateAccept, InviteUpdateDecline } from "./types"; - -export const inviteAction = (data: T): Poke => ({ - app: 'invite-store', - mark: 'invite-action', - json: data -}); - -export const accept = ( - app: string, - uid: Serial -): Poke => inviteAction({ - accept: { - term: app, - uid - } -}); - -export const decline = ( - app: string, - uid: Serial -): Poke => inviteAction({ - decline: { - term: app, - uid - } -}); diff --git a/ui/src/gear/invite/types.ts b/ui/src/gear/invite/types.ts deleted file mode 100644 index e0e95745..00000000 --- a/ui/src/gear/invite/types.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { PatpNoSig, Path } from '@urbit/js-http-api'; -import { Serial } from '@/gear'; -import { Resource } from "../groups"; - -export type InviteUpdate = - InviteUpdateInitial -| InviteUpdateCreate -| InviteUpdateDelete -| InviteUpdateInvite -| InviteUpdateAccept -| InviteUpdateAccepted -| InviteUpdateDecline; - -export interface InviteUpdateAccept { - accept: { - term: string; - uid: Serial; - } -} - -export interface InviteUpdateInitial { - initial: Invites; -} - -export interface InviteUpdateCreate { - create: { - term: string; - }; -} - -export interface InviteUpdateDelete { - delete: { - term: string; - }; -} - -export interface InviteUpdateInvite { - invite: { - term: string; - uid: Serial; - invite: Invite; - }; -} - -export interface InviteUpdateAccepted { - accepted: { - term: string; - uid: Serial; - }; -} - -export interface InviteUpdateDecline { - decline: { - term: string; - uid: Serial; - }; -} - -// actual datastructures - - -export type Invites = { - [p in Path]: AppInvites; -}; - -export type AppInvites = { - [s in Serial]: Invite; -}; - -export interface Invite { - app: string; - recipient: PatpNoSig; - resource: Resource; - ship: PatpNoSig; - text: string; -} diff --git a/ui/src/gear/metadata/index.ts b/ui/src/gear/metadata/index.ts deleted file mode 100644 index 341e8171..00000000 --- a/ui/src/gear/metadata/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './types'; -export * from './lib'; \ No newline at end of file diff --git a/ui/src/gear/metadata/lib.ts b/ui/src/gear/metadata/lib.ts deleted file mode 100644 index 64b91fc7..00000000 --- a/ui/src/gear/metadata/lib.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { parseUx } from '@urbit/aura'; -import { Path, Poke, PatpNoSig } from '@urbit/js-http-api'; -import { MdAppName, Association, Metadata, MetadataUpdate, MetadataUpdateAdd, MetadataUpdateRemove, MetadataEditField, MetadataUpdateEdit } from './types'; - -export const METADATA_UPDATE_VERSION = 2; - -export const metadataAction = (data: T, version: number = METADATA_UPDATE_VERSION): Poke => ({ - app: 'metadata-push-hook', - mark: `metadata-update-${version}`, - json: data -}); - -export const add = ( - ship: PatpNoSig, - appName: MdAppName, - resource: Path, - group: Path, - title: string, - description: string, - dateCreated: string, - color: string, - moduleName: string -): Poke => metadataAction({ - add: { - group, - resource: { - resource, - 'app-name': appName - }, - metadata: { - title, - description, - color, - 'date-created': dateCreated, - creator: `~${ship}`, - config: { graph: moduleName }, - picture: '', - hidden: false, - preview: false, - vip: '' - } - } -}); - -export { add as metadataAdd }; - -export const remove = ( - appName: MdAppName, - resource: string, - group: string -): Poke => metadataAction({ - remove: { - group, - resource: { - resource, - 'app-name': appName - } - } -}); - -export { remove as metadataRemove }; - -export const edit = ( - association: Association, - edit: MetadataEditField -): Poke => metadataAction({ - edit: { - group: association.group, - resource: { - resource: association.resource, - 'app-name': association['app-name'] - }, - edit - } -}); - -export { edit as metadataEdit }; - -/** - * @deprecated use {@link edit} instead - */ -export const update = ( - association: Association, - newMetadata: Partial -): Poke => { - const metadata = { ...association.metadata, ...newMetadata }; - metadata.color = parseUx(metadata.color); - return metadataAction({ - add: { - group: association.group, - resource: { - resource: association.resource, - 'app-name': association['app-name'] - }, - metadata - } - }); -}; - -export { update as metadataUpdate }; diff --git a/ui/src/gear/metadata/types.ts b/ui/src/gear/metadata/types.ts deleted file mode 100644 index 0d83135c..00000000 --- a/ui/src/gear/metadata/types.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Path, Patp } from '@urbit/js-http-api'; - -export type MdAppName = 'groups' | 'graph'; - -export type MetadataUpdate = - MetadataUpdateInitial -| MetadataUpdateAdd -| MetadataUpdateUpdate -| MetadataUpdateRemove -| MetadataUpdateEdit; - -export interface MetadataUpdateInitial { - associations: ResourceAssociations; -} - -export type ResourceAssociations = { - [p in Path]: Association; -} - -export type MetadataUpdateAdd = { - add: AssociationPoke; -} - -export type MetadataUpdateUpdate = { - update: AssociationPoke; -} - -export interface MetadataUpdateEdit { - edit: { - resource: MdResource; - group: string; - edit: MetadataEditField; - } -} - -export type MetadataEditField = Partial>; - -export type MetadataUpdateRemove = { - remove: { - resource: MdResource; - group: string; - } -} - -export interface MdResource { - resource: string; - 'app-name': MdAppName; -} - -export interface MetadataUpdatePreview { - group: string; - channels: Associations; - 'channel-count': number; - members: number; - metadata: Metadata; -} - -export type Associations = { - groups: AppAssociations - graph: AppAssociations; -} - -export type AppAssociations = { - [p in Path]: Association; -} - -export type Association = MdResource & { - group: Path; - metadata: Metadata; -}; - -export interface AssociationPoke { - group: Path; - resource: MdResource; - metadata: Metadata; -} - -export interface Metadata { - color: string; - creator: Patp; - 'date-created': string; - description: string; - title: string; - config: C; - hidden: boolean; - picture: string; - preview: boolean; - vip: PermVariation; -} - -export type MetadataConfig = GroupConfig | GraphConfig; - -export interface GraphConfig { - graph: string; -} - -export interface GroupConfig { - group: undefined | {} | MdResource; -} - -export type PermVariation = '' | ' ' | 'reader-comments' | 'member-metadata' | 'host-feed' | 'admin-feed';