diff --git a/src/config.ts b/src/config.ts index 303fef3..c82835a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -37,3 +37,4 @@ export const WALLPAPERS: IWallpaperConfig[] = [ /** * TODO: Maybe include (sub)cathegories (Already included in name [0]) */ +c; diff --git a/src/interfaces/IWallpaperConfig.ts b/src/interfaces/IWallpaperConfig.ts index 5c7a650..89874ba 100644 --- a/src/interfaces/IWallpaperConfig.ts +++ b/src/interfaces/IWallpaperConfig.ts @@ -7,10 +7,13 @@ import { string_url_image, } from '@collboard/modules-sdk'; -export interface IWallpaperConfig { +// !!! To maker file + +export interface IWallpaperConfig /* !!! Extends IModuleManifest*/{ + /* !!! Remove /** * Unique name of the wallpaper in a module name - */ + * / name: string; /** @@ -20,14 +23,16 @@ export interface IWallpaperConfig { /** * Title to display in the UI and module store - */ + * / title: IStringMessage; /** * Description to display in the module store - */ + * / description: IStringMessage; + */ + /** * Source of the wallpaper */ diff --git a/src/makers/makeBackgroundWallpaperModule.ts b/src/makers/makeBackgroundWallpaperModule.ts new file mode 100644 index 0000000..ad0c2bc --- /dev/null +++ b/src/makers/makeBackgroundWallpaperModule.ts @@ -0,0 +1,69 @@ +import { BackgroundWallpaperArt, IModuleDefinition, IModuleManifest, ISystems } from '@collboard/modules-sdk'; +import { IWallpaperConfig } from '../interfaces/IWallpaperConfig'; + +/** + * Makes a module which places a wallpaper + * + */ +export function makeBackgroundWallpaperModule( + wallpaperModuleManifest: IModuleManifest & IWallpaperConfig, +): IModuleDefinition { + const { manifest, place, order, createElement } = wallpaperModuleManifest; + + return { + manifest: wallpaperModuleManifest, + async setup(systems: ISystems) { + const { virtualArtVersioningSystem } = await systems.request('virtualArtVersioningSystem'); + + return virtualArtVersioningSystem + .createPrimaryOperation() + .newArts(new BackgroundWallpaperArt(wallpaperModuleManifest.src)) + .persist(); + }, + }; +} + +/* + + +{ + manifest: { + name: `${packageName}/space`, + version, + deprecatedNames: 'SpaceBackground', + title: { en: 'Space', cs: 'Vesmír' }, + description: { en: 'Changes white background to space.', cs: 'Vymění bílé pozadí za vesmírné.' }, + + categories: [ + 'Wallpaper', + 'Geography', + 'Space', + 'Education' /* Not template because to user do not seem so * /, + ], + icon: '🌌', // TODO: Icon because other planets than Earth and Moon do not have emoji icon + screenshots: [ + /*TODO:* / + ], + author: Authors.hejny, + }, + + async setup(systems) { + + }, + } + + + + + + + + + + + +*/ + +/** + * TODO: Should makers recieve object with manifest OR extended manifest? + */