diff --git a/README.md b/README.md index 1c642f0..3153c6a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Find and replace all on all files (CMD+SHIFT+F): [![License][license-src]][license-href] [![Nuxt][nuxt-src]][nuxt-href] -![CmsKatze](/src/runtime/assets/logo.svg) +![CmsKatze](/src/runtime/assets/logo_outlines.svg) - [✨  Release Notes](/CHANGELOG.md) @@ -22,7 +22,6 @@ Find and replace all on all files (CMD+SHIFT+F): ## Warning In active development, not ready for production use. -The content.katze.json is not being synced with Git LFS or Git _Feel free to contribute to this project by creating a pull request.🐱❤️_ @@ -35,12 +34,12 @@ _Feel free to contribute to this project by creating a pull request.🐱❤️_ ## Quick Setup 1. Install using: `npm install @maxlkate/cms@latest` -2. Add `@maxlkate/cms` to the `modules` section of `nuxt.config.js` +2. Add `@maxlkatze/cms` to the `modules` section of `nuxt.config.js` ```js { modules: [ - '@maxlkate/cms' + '@maxlkatze/cms' ] } ``` @@ -124,8 +123,15 @@ You can configure Katze by adding the `katzenCore` key to `nuxt.config.js` password: 'your secret password', // default: "admin" }, ], - secret: 'your secret key for token encryption', - projectLocation: './', // default: "./" + secret: 'your secret key for token encryption', + projectLocation: './', // default: "./", + projectName: 'YourSiteName', + storage: { + type: 'fs', // default: "fs" | Unstorage Types supported + options: { + // UNSTORAGE OPTIONS + } + } } ``` #### Users @@ -137,6 +143,32 @@ The secret is used to encrypt the Login token for the CMS editor. #### Project Location The project location is used to store the content.katze.json fileand to locate the public folder. +#### Project Name +The project name is used to identify the project in the Storage. + +#### Storage +The storage can be configured with unstorage drivers. + +##### Supported Unstorage Drivers +- azure-app-configuration - [Documentation](https://unstorage.unjs.io/drivers/azure) +- cloudflare-kv-binding - [Documentation](https://unstorage.unjs.io/drivers/cloudflare) +- fs - [Documentation](https://unstorage.unjs.io/drivers/fs) +- github - [Documentation](https://unstorage.unjs.io/drivers/github) +- mongodb - [Documentation](https://unstorage.unjs.io/drivers/mongodb) +- netlify-blobs - [Documentation](https://unstorage.unjs.io/drivers/netlify) +- planetscale - [Documentation](https://unstorage.unjs.io/drivers/planetscale) +- redis - [Documentation](https://unstorage.unjs.io/drivers/redis) +- vercel-kv - [Documentation](https://unstorage.unjs.io/drivers/vercel) + +Storage implementation example: +```js +storage: { + type: 'fs', + options: { + base: './', + } +} +``` ## Contribution diff --git a/src/module.ts b/src/module.ts index 4af928a..1834c35 100644 --- a/src/module.ts +++ b/src/module.ts @@ -21,7 +21,7 @@ import { type PlanetscaleDriverOptions } from 'unstorage/drivers/planetscale' import { type RedisOptions } from 'unstorage/drivers/redis' import { type VercelKVOptions } from 'unstorage/drivers/vercel-kv' import pkg from '../package.json' -import { useContentStorage } from './runtime/storage/StorageManagment' +import { useContentStorage } from './runtime/storage/StorageManagement' export interface CmsUser { name: string @@ -37,12 +37,13 @@ export interface ModuleOptions { type: 'azure-app-configuration' | 'cloudflare-kv-binding' | 'fs' | 'github' | 'mongodb' | 'netlify-blobs' | 'planetscale' | 'redis' | 'vercel-kv' options: AzureAppConfigurationOptions | KVOptions | FSStorageOptions | GithubOptions | MongoDbOptions | NetlifyStoreOptions | PlanetscaleDriverOptions | RedisOptions | VercelKVOptions } + deployHookURL?: string } export default defineNuxtModule({ meta: { - name: 'KatzenCore', - configKey: 'katzenCore', + name: 'CMSKatze', + configKey: 'katze', }, // Default configuration options of the Nuxt module defaults: { @@ -107,6 +108,7 @@ export default defineNuxtModule({ _nuxt.options.runtimeConfig.projectLocation = _options.projectLocation + (_options.projectLocation.endsWith('/') ? '' : '/') const storageKey = _options.projectName + '_katze_content' _nuxt.options.runtimeConfig.storageKey = storageKey + _nuxt.options.runtimeConfig.deployHookURL = _options.deployHookURL const contentStorage = await useContentStorage(_nuxt.options.runtimeConfig) let content = await contentStorage.getItem(storageKey) diff --git a/src/runtime/assets/icons/cloud.svg b/src/runtime/assets/icons/cloud.svg deleted file mode 100644 index bb3221e..0000000 --- a/src/runtime/assets/icons/cloud.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/edit.svg b/src/runtime/assets/icons/edit.svg new file mode 100644 index 0000000..d72ec16 --- /dev/null +++ b/src/runtime/assets/icons/edit.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/runtime/assets/icons/eye.svg b/src/runtime/assets/icons/eye.svg deleted file mode 100644 index 216b71c..0000000 --- a/src/runtime/assets/icons/eye.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/fail.svg b/src/runtime/assets/icons/fail.svg new file mode 100644 index 0000000..68efaa4 --- /dev/null +++ b/src/runtime/assets/icons/fail.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/runtime/assets/icons/fire.svg b/src/runtime/assets/icons/fire.svg deleted file mode 100644 index d718888..0000000 --- a/src/runtime/assets/icons/fire.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/flash.svg b/src/runtime/assets/icons/flash.svg deleted file mode 100644 index 660f7c6..0000000 --- a/src/runtime/assets/icons/flash.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/flower.svg b/src/runtime/assets/icons/flower.svg deleted file mode 100644 index c8b916d..0000000 --- a/src/runtime/assets/icons/flower.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/heart.svg b/src/runtime/assets/icons/heart.svg deleted file mode 100644 index 3b2d6a1..0000000 --- a/src/runtime/assets/icons/heart.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/publish.svg b/src/runtime/assets/icons/publish.svg new file mode 100644 index 0000000..b18f61f --- /dev/null +++ b/src/runtime/assets/icons/publish.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/runtime/assets/icons/shroom.svg b/src/runtime/assets/icons/shroom.svg deleted file mode 100644 index ec2f092..0000000 --- a/src/runtime/assets/icons/shroom.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/star.svg b/src/runtime/assets/icons/star.svg deleted file mode 100644 index e1867bc..0000000 --- a/src/runtime/assets/icons/star.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/icons/tongue.svg b/src/runtime/assets/icons/tongue.svg deleted file mode 100644 index de19331..0000000 --- a/src/runtime/assets/icons/tongue.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/runtime/assets/logo_outlines.svg b/src/runtime/assets/logo_outlines.svg new file mode 100644 index 0000000..506b91f --- /dev/null +++ b/src/runtime/assets/logo_outlines.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/runtime/components/views/EditView.vue b/src/runtime/components/views/EditView.vue index dbcbef7..b665f23 100644 --- a/src/runtime/components/views/EditView.vue +++ b/src/runtime/components/views/EditView.vue @@ -258,10 +258,16 @@ interface SaveResponse { success: boolean } -const saveLoading = ref(false) -const saveSuccess = ref(false) +const saveState = ref({ + loading: false, + success: false, + failed: false, +}) + +const hasSaveState = computed(() => saveState.value.loading || saveState.value.success || saveState.value.failed) + const saveUiContent = async () => { - saveLoading.value = true + saveState.value.loading = true const uiContent = uiStore.getUiContent() const token = useCookie('token') const data: SaveResponse = await $fetch('/content-cms', { @@ -272,11 +278,46 @@ const saveUiContent = async () => { action: 'save', }, }) - saveLoading.value = false - saveSuccess.value = data.success + saveState.value.loading = false + saveState.value.success = data.success + saveState.value.failed = !data.success + + setTimeout(() => { + saveState.value.success = false + saveState.value.failed = false + }, 2000) +} + +const publishPopup = ref(false) + +const publishState = ref({ + loading: false, + success: false, + failed: false, +}) + +const hasPublishState = computed(() => publishState.value.loading || publishState.value.success || publishState.value.failed) + +const deployContent = async () => { + publishPopup.value = false + + publishState.value.loading = true + const token = useCookie('token') + console.log('deploy') + const data: SaveResponse = await $fetch('/content-cms', { + method: 'POST', + body: { + token: token.value, + action: 'deploy', + }, + }) + publishState.value.loading = false + publishState.value.success = data.success + publishState.value.failed = !data.success setTimeout(() => { - saveSuccess.value = false + publishState.value.success = false + publishState.value.failed = false }, 2000) } @@ -354,10 +395,10 @@ watch(selectedImage, () => { Edit Pages - +
{
-
+
+ + +