Skip to content

Commit

Permalink
feat: add item settings with maxWidth (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia authored Aug 30, 2023
1 parent 59f24e7 commit 7164a1c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
12 changes: 12 additions & 0 deletions src/services/file/interfaces/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ItemSettings } from '@/services';

export enum MaxWidth {
Small = 'sm',
Medium = 'md',
Large = 'lg',
ExtraLarge = 'xl',
}

export interface FileItemSettings extends ItemSettings {
maxWidth?: MaxWidth;
}
1 change: 1 addition & 0 deletions src/services/items/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './interfaces/item';
export * from './interfaces/itemSettings';
38 changes: 9 additions & 29 deletions src/services/items/interfaces/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,9 @@ import { AppItemExtra } from '../../app/';
import { EtherpadItemExtra } from '../../etherpad';
import { LocalFileItemExtra, S3FileItemExtra } from '../../file';
import { H5PItemExtra } from '../../h5p';
import { CCLicenseAdaptions, Member, OldCCLicenseAdaptations } from '@/index';

export interface ItemSettings {
lang?: string;
isPinned?: boolean;
showChatbox?: boolean;
hasThumbnail?: boolean;
isResizable?: boolean;
isCollapsible?: boolean;
enableSaveActions?: boolean;
tags?: string[];
displayCoEditors?: boolean;
ccLicenseAdaption?:
| `${CCLicenseAdaptions}`
| CCLicenseAdaptions
// todo: these are the old licenses, we might remove them at some point.
| `${OldCCLicenseAdaptations}`;
}

export interface EmbeddedLinkItemSettings extends ItemSettings {
showLinkIframe?: boolean;
showLinkButton?: boolean;
}
import { EmbeddedLinkItemSettings, ItemSettings } from './itemSettings';
import { Member } from '@/index';
import { FileItemSettings } from '@/services/file/interfaces/settings';

export interface Item<S = ItemSettings> {
id: string;
Expand Down Expand Up @@ -65,14 +45,14 @@ export type EmbeddedLinkItemType<S = ItemSettings> = {
extra: EmbeddedLinkItemExtra;
settings: EmbeddedLinkItemSettings;
} & Item<S>;
export type LocalFileItemType<S = ItemSettings> = {
export type LocalFileItemType = {
type: `${ItemType.LOCAL_FILE}`;
extra: LocalFileItemExtra;
} & Item<S>;
export type S3FileItemType<S = ItemSettings> = {
} & Item<FileItemSettings>;
export type S3FileItemType = {
type: `${ItemType.S3_FILE}`;
extra: S3FileItemExtra;
} & Item<S>;
} & Item<FileItemSettings>;
export type ShortcutItemType<S = ItemSettings> = {
type: `${ItemType.SHORTCUT}`;
extra: ShortcutItemExtra;
Expand All @@ -88,7 +68,7 @@ export type DiscriminatedItem<S = ItemSettings> =
| FolderItemType<S>
| H5PItemType<S>
| EmbeddedLinkItemType<S>
| LocalFileItemType<S>
| S3FileItemType<S>
| LocalFileItemType
| S3FileItemType
| ShortcutItemType<S>
| EtherpadItemType<S>;
23 changes: 23 additions & 0 deletions src/services/items/interfaces/itemSettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { CCLicenseAdaptions, OldCCLicenseAdaptations } from '@/constants';

export interface ItemSettings {
lang?: string;
isPinned?: boolean;
showChatbox?: boolean;
hasThumbnail?: boolean;
isResizable?: boolean;
isCollapsible?: boolean;
enableSaveActions?: boolean;
tags?: string[];
displayCoEditors?: boolean;
ccLicenseAdaption?:
| `${CCLicenseAdaptions}`
| CCLicenseAdaptions
// todo: these are the old licenses, we might remove them at some point.
| `${OldCCLicenseAdaptations}`;
}

export interface EmbeddedLinkItemSettings extends ItemSettings {
showLinkIframe?: boolean;
showLinkButton?: boolean;
}

0 comments on commit 7164a1c

Please sign in to comment.