diff --git a/README.md b/README.md index 79cc068e..3bf3abbd 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Install all dependencies and serve locally. ```sh npm install -npm serve +npm run serve ``` ## Deploy to Firebase diff --git a/apps/cms/.env.local.example b/apps/cms/.env.local.example index 14e24ee0..35235649 100644 --- a/apps/cms/.env.local.example +++ b/apps/cms/.env.local.example @@ -1,3 +1,5 @@ +GOOGLE_GENAI_API_KEY= + NEXT_PUBLIC_FIREBASE_API_KEY= NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN= NEXT_PUBLIC_FIREBASE_DATABASE_URL= diff --git a/apps/cms/src/components/Form/Dropzone.tsx b/apps/cms/src/components/Form/Dropzone.tsx index b3efd71c..35bc9884 100644 --- a/apps/cms/src/components/Form/Dropzone.tsx +++ b/apps/cms/src/components/Form/Dropzone.tsx @@ -1,7 +1,7 @@ "use client"; import {AcceptFileType} from "@tanam/domain-frontend"; +import {getAcceptDescription, isFileAccepted} from "@tanam/domain-shared"; import React, {useEffect, useRef, useState} from "react"; -import {getAcceptDescription, isFileAccepted} from "../../utils/fileUpload"; import "./styles/dropzone.scss"; export interface DropzoneProps { diff --git a/apps/cms/src/hooks/useFirebaseStorage.tsx b/apps/cms/src/hooks/useFirebaseStorage.tsx index da1c9dfe..9d04c800 100644 --- a/apps/cms/src/hooks/useFirebaseStorage.tsx +++ b/apps/cms/src/hooks/useFirebaseStorage.tsx @@ -1,8 +1,8 @@ import {UserNotification} from "@tanam/domain-frontend"; +import {base64ToBlob} from "@tanam/domain-shared"; import {getDownloadURL, ref, uploadBytes} from "firebase/storage"; import {useState} from "react"; import {storage} from "../plugins/firebase"; -import {base64ToBlob} from "../utils/fileUpload"; interface FirebaseStorageHook { isLoading: boolean; diff --git a/libs/domain-frontend/src/models/TanamUser.ts b/libs/domain-frontend/src/models/TanamUser.ts index c94620d8..f5982986 100644 --- a/libs/domain-frontend/src/models/TanamUser.ts +++ b/libs/domain-frontend/src/models/TanamUser.ts @@ -1,4 +1,4 @@ -import {TanamRole, TanamUserBase} from "@tanam/domain-shared"; +import {TanamUserBase} from "@tanam/domain-shared"; import {DocumentSnapshot, FieldValue, serverTimestamp, Timestamp} from "firebase/firestore"; export class TanamUser extends TanamUserBase { diff --git a/libs/domain-shared/src/definitions/AcceptFileType.ts b/libs/domain-shared/src/definitions/AcceptFileType.ts index 3195f04b..252db1d5 100644 --- a/libs/domain-shared/src/definitions/AcceptFileType.ts +++ b/libs/domain-shared/src/definitions/AcceptFileType.ts @@ -13,7 +13,6 @@ export enum AcceptFileType { Excel = "application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", PowerPoint = "application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation", Text = "text/plain", - Audio = "audio/*", Video = "video/*", Zip = "application/zip, application/x-rar-compressed, application/x-7z-compressed", Csv = "text/csv", @@ -25,6 +24,7 @@ export enum AcceptFileType { Flac = "audio/flac", Aac = "audio/aac", Wma = "audio/x-ms-wma", + Audio = `${AcceptFileType.AllAudios}`, Audios = `${AcceptFileType.Mp3}, ${AcceptFileType.Wav}, ${AcceptFileType.Ogg}`, AllFiles = "*/*", } diff --git a/libs/domain-shared/src/utils/documentTypeGenerator.ts b/libs/domain-shared/src/utils/documentTypeGenerator.ts deleted file mode 100644 index e1b68724..00000000 --- a/libs/domain-shared/src/utils/documentTypeGenerator.ts +++ /dev/null @@ -1,106 +0,0 @@ -import {LocalizedString, TanamDocumentField, TanamDocumentType} from "@tanam/domain-frontend"; - -export interface IDocumentTypeDataResult { - data: TanamDocumentType; - fields: TanamDocumentField[]; -} - -export function getDocumentTypeArticle(): IDocumentTypeDataResult { - const data = new TanamDocumentType( - "article", - new LocalizedString({en: "Article"}), - new LocalizedString({en: "Articles"}), - new LocalizedString({en: "Article such as a blog post or a published article."}), - "title", - true, - ); - - const fields: TanamDocumentField[] = [ - new TanamDocumentField("title", { - weight: 1000, - title: new LocalizedString({en: "Title"}), - description: new LocalizedString({en: "Article title"}), - type: "string", - validators: ["required"], - }), - new TanamDocumentField("featuredImage", { - weight: 2000, - title: new LocalizedString({en: "Featured image"}), - description: new LocalizedString({ - en: "Featured image to display on the article page and to use for social media sharing.", - }), - type: "image", - validators: ["required"], - }), - new TanamDocumentField("content", { - weight: 3000, - title: new LocalizedString({en: "Content"}), - description: new LocalizedString({ - en: "Content body of the article.", - }), - type: "html", - validators: ["required"], - }), - new TanamDocumentField("canonicalUrl", { - weight: 4000, - title: new LocalizedString({en: "Canonical URL"}), - description: new LocalizedString({ - en: "Content body of the article.", - }), - type: "string", - validators: ["url"], - }), - new TanamDocumentField("tags", { - weight: 5000, - title: new LocalizedString({en: "Tags"}), - description: new LocalizedString({ - en: "Tags to categorize the article.", - }), - type: "array:string", - validators: ["url"], - }), - ]; - - return {data, fields}; -} - -export function getDocumentTypePerson(): IDocumentTypeDataResult { - const data = new TanamDocumentType( - "person", - new LocalizedString({en: "Person"}), - new LocalizedString({en: "People"}), - new LocalizedString({en: "People such as authors, contributors, and staff members."}), - "name", - true, - ); - - const fields: TanamDocumentField[] = [ - new TanamDocumentField("name", { - weight: 1000, - title: new LocalizedString({en: "Name"}), - description: new LocalizedString({en: "Full name"}), - type: "string", - validators: ["required"], - }), - new TanamDocumentField("image", { - weight: 2000, - title: new LocalizedString({en: "Image"}), - description: new LocalizedString({ - en: "Photo of the person.", - }), - type: "image", - validators: [], - }), - new TanamDocumentField("bio", { - weight: 3000, - title: new LocalizedString({en: "Bio"}), - description: new LocalizedString({ - en: "Bio or description of the person.", - }), - type: "text-paragraph", - validators: [], - }), - ]; - - return {data, fields}; -} diff --git a/libs/domain-shared/src/utils/index.ts b/libs/domain-shared/src/utils/index.ts index be92329d..3d08236c 100644 --- a/libs/domain-shared/src/utils/index.ts +++ b/libs/domain-shared/src/utils/index.ts @@ -1,3 +1,2 @@ export * from "./date"; -export * from "./documentTypeGenerator"; export * from "./fileUpload";