From d01c0de124cb9af00312e4c53e934d8a233e02af Mon Sep 17 00:00:00 2001 From: ryanwolhuter Date: Fri, 19 Apr 2024 11:23:52 +0200 Subject: [PATCH 1/9] feat: add dependency versions to settings modal Signed-off-by: ryanwolhuter --- package-lock.json | 7 ++++--- package.json | 2 +- src/components/modal/modals/SettingsModal.tsx | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 204e01c7..73193240 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0-alpha.6", "license": "AGPL-3.0-only", "dependencies": { - "@powerhousedao/design-system": "1.0.0-alpha.97", + "@powerhousedao/design-system": "^1.0.0-alpha.99", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", "document-drive": "1.0.0-alpha.41", @@ -3422,8 +3422,9 @@ } }, "node_modules/@powerhousedao/design-system": { - "version": "1.0.0-alpha.97", - "license": "AGPL-3.0-only", + "version": "1.0.0-alpha.99", + "resolved": "https://registry.npmjs.org/@powerhousedao/design-system/-/design-system-1.0.0-alpha.99.tgz", + "integrity": "sha512-DXnCWYHmMxiWm2uCHL4kA4zaNifHAck2Mb/m/IiH0wsEISSOkVjqRCssIt5YI5kUfpe87Mx0cGOR8UgyFpzWbg==", "dependencies": { "@internationalized/date": "^3.5.1", "@radix-ui/react-dialog": "^1.0.5", diff --git a/package.json b/package.json index 1566f272..b6ee0c82 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "xvfb-maybe": "^0.2.1" }, "dependencies": { - "@powerhousedao/design-system": "1.0.0-alpha.97", + "@powerhousedao/design-system": "^1.0.0-alpha.99", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", "document-drive": "1.0.0-alpha.41", diff --git a/src/components/modal/modals/SettingsModal.tsx b/src/components/modal/modals/SettingsModal.tsx index e14b289b..fd5ee296 100644 --- a/src/components/modal/modals/SettingsModal.tsx +++ b/src/components/modal/modals/SettingsModal.tsx @@ -2,7 +2,8 @@ import { Button, ClearStorageSettingsRow, SettingsModal as ConnectSettingsModal, - DocumentSelectSettingsRow, + DependencyVersions, + DocumentSelectSettingsRow } from '@powerhousedao/design-system'; import { DocumentModel } from 'document-model/document'; import React, { useState } from 'react'; @@ -17,6 +18,7 @@ import { useFilteredDocumentModels, } from 'src/store/document-model'; import { useUser } from 'src/store/user'; +import packageJson from '../../../../package.json'; import { Login } from '../../login'; const mapDocumentModelsToOptions = (documentModels: DocumentModel[]) => @@ -138,6 +140,7 @@ export const SettingsModal: React.FC = props => { 'modals.connectSettings.clearStorage.description', )} /> + ); }; From 0d511546e95a1d5a534f92b549d7120076792040 Mon Sep 17 00:00:00 2001 From: acaldas Date: Fri, 19 Apr 2024 14:23:37 +0100 Subject: [PATCH 2/9] feat: fixed default document-models --- Dockerfile | 2 +- src/store/document-model.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28ac84a5..6686604c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ ENV VITE_SENTRY_ENV=${VITE_SENTRY_ENV} ARG VITE_DEFAULT_DRIVE_URL="" ENV VITE_DEFAULT_DRIVE_URL=${VITE_DEFAULT_DRIVE_URL} -ARG VITE_ENABLED_EDITORS=undefined +ARG VITE_ENABLED_EDITORS="*" ENV VITE_ENABLED_EDITORS=${VITE_ENABLED_EDITORS} ARG VITE_DISABLE_ADD_PUBLIC_DRIVES=false diff --git a/src/store/document-model.ts b/src/store/document-model.ts index 543583d7..e79440ef 100644 --- a/src/store/document-model.ts +++ b/src/store/document-model.ts @@ -44,10 +44,14 @@ export const useGetDocumentModel = () => { * @returns {Array} The filtered document models. */ export const useFilteredDocumentModels = () => { - const documentModels = useDocumentModels(); + const _documentModels = useDocumentModels(); const { config } = useFeatureFlag(); const { enabledEditors, disabledEditors } = config.editors; + const documentModels = _documentModels.filter( + model => model.documentModel.id !== 'powerhouse/document-drive', + ); + if (enabledEditors === '*') { return documentModels; } From 5d123af045f0409222bd61404b2249db2a4ec19d Mon Sep 17 00:00:00 2001 From: acaldas Date: Fri, 19 Apr 2024 14:44:09 +0100 Subject: [PATCH 3/9] feat: fixed file operations error --- Dockerfile | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6686604c..a3a4ecb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ ENV VITE_DISABLE_DELETE_CLOUD_DRIVES=${VITE_DISABLE_DELETE_CLOUD_DRIVES} ARG VITE_DISABLE_DELETE_LOCAL_DRIVES=false ENV VITE_DISABLE_DELETE_LOCAL_DRIVES=${VITE_DISABLE_DELETE_LOCAL_DRIVES} -ARG VITE_LOCAL_DRIVES_ENABLED=true +ARG VITE_LOCAL_DRIVES_ENABLED=false ENV VITE_LOCAL_DRIVES_ENABLED=${VITE_LOCAL_DRIVES_ENABLED} WORKDIR /opt/app diff --git a/package-lock.json b/package-lock.json index 168b03ea..b80c34f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@powerhousedao/design-system": "1.0.0-alpha.97", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "1.0.0-alpha.41", + "document-drive": "^1.0.0-alpha.43", "document-model": "^1.0.51", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", @@ -9344,9 +9344,9 @@ } }, "node_modules/document-drive": { - "version": "1.0.0-alpha.41", - "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.41.tgz", - "integrity": "sha512-THFqagGjNajva9wouTZB7oK9HKL0G1jQXIBrJXMTvjw7VvrWJPeYn1Kc/pDvq/qpB2GwVfkOVv1XfcRvO9I1eQ==", + "version": "1.0.0-alpha.43", + "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.43.tgz", + "integrity": "sha512-d3wNVWA0AtrnDU9b79TkkpOxBdnME7bVO/v+QBOtNQaqEd1vIRJ52U3BWniAT4d/B8SqxWbxqmJrPZAu1x+2cA==", "dependencies": { "graphql": "^16.8.1", "graphql-request": "^6.1.0", diff --git a/package.json b/package.json index b08a8d5c..6ad16f8f 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "@powerhousedao/design-system": "1.0.0-alpha.97", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "1.0.0-alpha.41", + "document-drive": "^1.0.0-alpha.43", "document-model": "^1.0.51", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", From a18c621a24d97b3bfa9f103365b3890f6fd342d7 Mon Sep 17 00:00:00 2001 From: ryanwolhuter Date: Mon, 22 Apr 2024 16:13:03 +0200 Subject: [PATCH 4/9] feat: bump design system to integrate dep version component Signed-off-by: ryanwolhuter --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 131d2685..6a763c90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0-alpha.6", "license": "AGPL-3.0-only", "dependencies": { - "@powerhousedao/design-system": "^1.0.0-alpha.99", + "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", "document-drive": "^1.0.0-alpha.43", @@ -3425,9 +3425,9 @@ } }, "node_modules/@powerhousedao/design-system": { - "version": "1.0.0-alpha.99", - "resolved": "https://registry.npmjs.org/@powerhousedao/design-system/-/design-system-1.0.0-alpha.99.tgz", - "integrity": "sha512-DXnCWYHmMxiWm2uCHL4kA4zaNifHAck2Mb/m/IiH0wsEISSOkVjqRCssIt5YI5kUfpe87Mx0cGOR8UgyFpzWbg==", + "version": "1.0.0-alpha.100", + "resolved": "https://registry.npmjs.org/@powerhousedao/design-system/-/design-system-1.0.0-alpha.100.tgz", + "integrity": "sha512-i6hqLs2VR2QL2Z1EChUazPP4nPPWsT8uui4JU9u7sEABw2SZxpDzVoFG/FkjyCi8WPTGmAwPW4Hjvd7PCujHag==", "dependencies": { "@internationalized/date": "^3.5.1", "@radix-ui/react-dialog": "^1.0.5", diff --git a/package.json b/package.json index 8376c2bc..aeeb3b89 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "xvfb-maybe": "^0.2.1" }, "dependencies": { - "@powerhousedao/design-system": "^1.0.0-alpha.99", + "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", "document-drive": "^1.0.0-alpha.43", From 3024578d93e4a70a89a3b3681d34f78a4bd0f1d0 Mon Sep 17 00:00:00 2001 From: acaldas Date: Mon, 22 Apr 2024 17:57:09 +0100 Subject: [PATCH 5/9] feat: fix console warnings --- src/hooks/useIsAllowedToCreateDocuments.ts | 5 ----- src/store/user.ts | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/hooks/useIsAllowedToCreateDocuments.ts b/src/hooks/useIsAllowedToCreateDocuments.ts index bdc64695..20fe9eca 100644 --- a/src/hooks/useIsAllowedToCreateDocuments.ts +++ b/src/hooks/useIsAllowedToCreateDocuments.ts @@ -9,11 +9,6 @@ export function useIsAllowedToCreateDocuments() { const createDocumentAllowList = createDocumentAllowListEnvString?.split(','); if (createDocumentAllowList === undefined) { - console.warn(` - WARNING: The VITE_CREATE_DOCUMENT_ALLOW_LIST environment variable is not set. - This means that _any_ users will be allowed to create documents. - `); - return true; } diff --git a/src/store/user.ts b/src/store/user.ts index 73e621c0..2ed2f433 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,12 +1,19 @@ -import { useEffect, useState } from 'react'; +import { atom, useAtom } from 'jotai'; +import { useEffect } from 'react'; import { useRenown } from 'src/hooks/useRenown'; import type { User } from 'src/services/renown/types'; +let userInit = false; + +const userAtom = atom(undefined); + export const useUser = () => { - const [user, setUser] = useState(undefined); + const [user, setUser] = useAtom(userAtom); const renown = useRenown(); useEffect(() => { + if (userInit) return; + userInit = true; renown ?.user() .then(user => { @@ -20,8 +27,11 @@ export const useUser = () => { setUser(user); }); - return unsub; - }, [renown]); + return () => { + unsub?.(); + userInit = false; + }; + }, [renown, userInit]); return user; }; From 3b6fa8daeedec0549451490c9a7efec733ab2b75 Mon Sep 17 00:00:00 2001 From: acaldas Date: Mon, 22 Apr 2024 18:09:58 +0100 Subject: [PATCH 6/9] feat: update deps --- package-lock.json | 20 ++++++++++---------- package.json | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a763c90..71e1c2dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,8 @@ "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "^1.0.0-alpha.43", - "document-model": "^1.0.51", + "document-drive": "^1.0.0-alpha.44", + "document-model": "^1.0.52", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", "electron-squirrel-startup": "^1.0.0", @@ -9345,9 +9345,9 @@ } }, "node_modules/document-drive": { - "version": "1.0.0-alpha.43", - "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.43.tgz", - "integrity": "sha512-d3wNVWA0AtrnDU9b79TkkpOxBdnME7bVO/v+QBOtNQaqEd1vIRJ52U3BWniAT4d/B8SqxWbxqmJrPZAu1x+2cA==", + "version": "1.0.0-alpha.44", + "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.44.tgz", + "integrity": "sha512-AgYrPgf4VOksjeV/xvdKfEXgezwJZGyeAzx5Ma/UeByqFPQetwfFWsueqowUB3Rn80IPdnbbH7ZULEfoef+i2w==", "dependencies": { "graphql": "^16.8.1", "graphql-request": "^6.1.0", @@ -9363,14 +9363,14 @@ "sqlite3": "^5.1.7" }, "peerDependencies": { - "document-model": "^1.0.45", - "document-model-libs": "^1.34.0" + "document-model": "^1.0.52", + "document-model-libs": "^1.36.0" } }, "node_modules/document-model": { - "version": "1.0.51", - "resolved": "https://registry.npmjs.org/document-model/-/document-model-1.0.51.tgz", - "integrity": "sha512-Bp4pWkCgK35f92jZCaZ6SZITdGH2yTvrfRYNyoUhBzu3pjBkOetAY7NxBCqW4H9Zs2pDYBP1Klk60NfaOOxA2w==", + "version": "1.0.52", + "resolved": "https://registry.npmjs.org/document-model/-/document-model-1.0.52.tgz", + "integrity": "sha512-zP6jVkVVJWelsdYpagOtcIouHWUYnVVRWeAwSC2YC0SOxowERG+NtSRx2Uk2v6UFVWOA78sPAeY4NQaNB0yWOw==", "dependencies": { "change-case": "^5.4.3", "immer": "^10.0.3", diff --git a/package.json b/package.json index aeeb3b89..ec273c8f 100644 --- a/package.json +++ b/package.json @@ -92,8 +92,8 @@ "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "^1.0.0-alpha.43", - "document-model": "^1.0.51", + "document-drive": "^1.0.0-alpha.44", + "document-model": "^1.0.52", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", "electron-squirrel-startup": "^1.0.0", From 5baaf2006c71885132bbdabb59976acf5cde8ce2 Mon Sep 17 00:00:00 2001 From: acaldas Date: Tue, 23 Apr 2024 09:27:24 +0100 Subject: [PATCH 7/9] feat: update document drive dep --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71e1c2dc..9ead4f88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "^1.0.0-alpha.44", + "document-drive": "^1.0.0-alpha.46", "document-model": "^1.0.52", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", @@ -9345,9 +9345,9 @@ } }, "node_modules/document-drive": { - "version": "1.0.0-alpha.44", - "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.44.tgz", - "integrity": "sha512-AgYrPgf4VOksjeV/xvdKfEXgezwJZGyeAzx5Ma/UeByqFPQetwfFWsueqowUB3Rn80IPdnbbH7ZULEfoef+i2w==", + "version": "1.0.0-alpha.46", + "resolved": "https://registry.npmjs.org/document-drive/-/document-drive-1.0.0-alpha.46.tgz", + "integrity": "sha512-vInSQsqy0u1OVlGGe7GcToUZpdauq7m4eRZ7UO4CSsehFp9g6JkC2RXtwAPJt7hqmeCZVVBJE9WfooxuniBCrw==", "dependencies": { "graphql": "^16.8.1", "graphql-request": "^6.1.0", diff --git a/package.json b/package.json index ec273c8f..92567f7d 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "@powerhousedao/design-system": "1.0.0-alpha.100", "@sentry/react": "^7.109.0", "did-key-creator": "^1.2.0", - "document-drive": "^1.0.0-alpha.44", + "document-drive": "^1.0.0-alpha.46", "document-model": "^1.0.52", "document-model-libs": "^1.36.0", "electron-is-dev": "^3.0.1", From 25a27d51fed340a22530d5d13e784bf5f9f66fab Mon Sep 17 00:00:00 2001 From: acaldas Date: Tue, 23 Apr 2024 11:10:55 +0100 Subject: [PATCH 8/9] feat: ignore drives with error --- src/hooks/useDocumentDrives.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hooks/useDocumentDrives.ts b/src/hooks/useDocumentDrives.ts index 2eacd1ca..a1a594f4 100644 --- a/src/hooks/useDocumentDrives.ts +++ b/src/hooks/useDocumentDrives.ts @@ -40,16 +40,21 @@ export function useDocumentDrives(server: IDocumentDriveServer) { ); const refreshDocumentDrives = useCallback(async () => { + const documentDrives: DocumentDriveDocument[] = []; try { const driveIds = await server.getDrives(); - const drives = await Promise.all( - driveIds.map(id => server.getDrive(id)), - ); - - setDocumentDrives(drives); + for (const id of driveIds) { + try { + const drive = await server.getDrive(id); + documentDrives.push(drive); + } catch (error) { + console.error(error); + } + } } catch (error) { console.error(error); - setDocumentDrives([]); + } finally { + setDocumentDrives(documentDrives); } }, [server]); From 5f3b172956ad3384ea168771919ef2929a72e3b8 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 23 Apr 2024 17:26:12 +0200 Subject: [PATCH 9/9] chore: allow list for makerdao staging --- .github/workflows/build-and-deploy-makerdao-staging.yaml | 2 +- Dockerfile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy-makerdao-staging.yaml b/.github/workflows/build-and-deploy-makerdao-staging.yaml index eab51d5b..c7ff0ba2 100644 --- a/.github/workflows/build-and-deploy-makerdao-staging.yaml +++ b/.github/workflows/build-and-deploy-makerdao-staging.yaml @@ -22,5 +22,5 @@ jobs: email: ${{ secrets.HEROKU_EMAIL }} heroku_api_key: ${{ secrets.HEROKU_API_KEY }} heroku_app_name: ${{ secrets.HEROKU_APP_NAME }} - docker_options: "--build-arg BASE_PATH=/alpha/makerdao/connect --build-arg VITE_BASE_HREF=/alpha/makerdao/connect/ --build-arg VITE_ROUTER_BASENAME=/alpha/makerdao/connect --build-arg VITE_SENTRY_DSN=${{ secrets.SENTRY_DSN }} --build-arg VITE_SENTRY_ENV=${{ secrets.SENTRY_ENV }} --build-arg VITE_DEFAULT_DRIVE_URL=https://apps.powerhouse.io/alpha/makerdao/switchboard/d/monetalis" + docker_options: "--build-arg BASE_PATH=/alpha/makerdao/connect --build-arg VITE_BASE_HREF=/alpha/makerdao/connect/ --build-arg VITE_ROUTER_BASENAME=/alpha/makerdao/connect --build-arg VITE_SENTRY_DSN=${{ secrets.SENTRY_DSN }} --build-arg VITE_SENTRY_ENV=${{ secrets.SENTRY_ENV }} --build-arg VITE_DEFAULT_DRIVE_URL=https://apps.powerhouse.io/alpha/makerdao/switchboard/d/monetalis --build-arg VITE_CREATE_DOCUMENT_ALLOW_LIST=${{secrets.VITE_CREATE_DOCUMENT_ALLOW_LIST}}" process_type: web \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a3a4ecb8..c6a86875 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,9 @@ ENV VITE_DISABLE_DELETE_LOCAL_DRIVES=${VITE_DISABLE_DELETE_LOCAL_DRIVES} ARG VITE_LOCAL_DRIVES_ENABLED=false ENV VITE_LOCAL_DRIVES_ENABLED=${VITE_LOCAL_DRIVES_ENABLED} +ARG VITE_CREATE_DOCUMENT_ALLOW_LIST="" +ENV VITE_CREATE_DOCUMENT_ALLOW_LIST=${VITE_CREATE_DOCUMENT_ALLOW_LIST} + WORKDIR /opt/app COPY . . RUN npm install -g husky vite