Skip to content

Commit

Permalink
Merge pull request #1627 from vivid-planet/merge-next-into-feature-re…
Browse files Browse the repository at this point in the history
…factor-admin-component-theming

Merge `next` into `feature/refactor-admin-component-theming`
  • Loading branch information
johnnyomair authored Jan 29, 2024
2 parents 5e29232 + f820f4d commit b640c97
Show file tree
Hide file tree
Showing 229 changed files with 3,067 additions and 2,498 deletions.
7 changes: 0 additions & 7 deletions .changeset/eighty-tools-fail.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/eleven-impalas-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": minor
---

Add `helperText` prop to `Field` and `FieldContainer` to provide additional information
22 changes: 0 additions & 22 deletions .changeset/fifty-crabs-love.md

This file was deleted.

43 changes: 43 additions & 0 deletions .changeset/rich-crews-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
"@comet/cms-admin": major
---

Make sites config generic

The sites config was previously assumed to be `Record<string, SiteConfg>`.
However, as the sites config is solely used in application code, it could be of any shape.
Therefore, the `SitesConfigProvider` and `useSitesConfig` are made generic.
The following changes have to be made in the application:

1. Define the type of your sites config

Preferably this should be done in `config.ts`:

```diff
export function createConfig() {
// ...

return {
...cometConfig,
apiUrl: environmentVariables.API_URL,
adminUrl: environmentVariables.ADMIN_URL,
+ sitesConfig: JSON.parse(environmentVariables.SITES_CONFIG) as SitesConfig,
};
}

+ export type SitesConfig = Record<string, SiteConfig>;
```

2. Use the type when using `useSitesConfig`

```diff
- const sitesConfig = useSitesConfig();
+ const sitesConfig = useSitesConfig<SitesConfig>();
```

3. Optional: Remove type annotation from `ContentScopeProvider#resolveSiteConfigForScope` (as it's now inferred)

```diff
- resolveSiteConfigForScope: (configs: Record<string, SiteConfig>, scope: ContentScope) => configs[scope.domain],
+ resolveSiteConfigForScope: (configs, scope: ContentScope) => configs[scope.domain],
```
3 changes: 2 additions & 1 deletion .changeset/sixty-cobras-brake.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Replace ContentScopeModule with UserPermissionsModule
Breaking changes:

- ContentScope-Module has been removed
- canAccessScope has been moved to AccessControlService and renamed to isAllowedContentScope
- canAccessScope has been moved to AccessControlService and refactored into isAllowed
- contentScopes- and permissions-fields have been added to CurrentUser-Object
- role- and rights-fields has been removed from CurrentUser-Object
- AllowForRole-decorator has been removed
- Rename decorator SubjectEntity to AffectedEntity
Expand Down
23 changes: 0 additions & 23 deletions .changeset/smart-weeks-behave.md

This file was deleted.

30 changes: 30 additions & 0 deletions .changeset/stale-wombats-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"@comet/admin": major
---

Change the signatures of `shouldScrollToField`, `shouldShowFieldError` and `shouldShowFieldWarning` in `FinalFormContext` to match the corresponding methods in `Field`

The API in `FinalFormContext` was changed from

```tsx
//
export interface FinalFormContext {
shouldScrollToField: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
shouldShowFieldError: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
shouldShowFieldWarning: ({ fieldMeta }: { fieldMeta: FieldMetaState<any> }) => boolean;
}
```

to

```tsx
//
export interface FinalFormContext {
shouldScrollToField: (fieldMeta: FieldMetaState<any>) => boolean;
shouldShowFieldError: (fieldMeta: FieldMetaState<any>) => boolean;
shouldShowFieldWarning: (fieldMeta: FieldMetaState<any>) => boolean;
}
```

Now the corresponding methods in `Field` and `FinalFormContext` have the same signature.

5 changes: 0 additions & 5 deletions .changeset/tricky-adults-laugh.md

This file was deleted.

23 changes: 0 additions & 23 deletions .changeset/yellow-seahorses-lick.md

This file was deleted.

2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ API_PORT=4000
API_URL=http://localhost:$API_PORT
API_URL_INTERNAL=http://localhost:$API_PORT
CORS_ALLOWED_ORIGINS="^http:\/\/localhost:\d+,^http://192.168.\d+.\d+:80[0-9]{2}"
SITE_PREVIEW_SECRET=uxa4ZBJ4exw8jgq-qrh

# blob storage
BLOB_STORAGE_DRIVER="file"
Expand All @@ -65,6 +64,7 @@ SITE_PORT=3000
SITE_URL=http://localhost:$SITE_PORT
SITE_PRELOGIN_ENABLED=false
SITE_PRELOGIN_PASSWORD=password
PREVIEW_URL=$SITE_URL/preview
# no gtm in dev mode
NEXT_PUBLIC_GTM_ID=
NEXT_PUBLIC_SITE_DOMAIN=main
Expand Down
4 changes: 4 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ addReviewers: true

reviewers:
- johnnyomair

skipKeywords:
- Merge main into next
- Version Packages
4 changes: 2 additions & 2 deletions copy-schema-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fs = require("fs");
fs.promises.copyFile("demo/api/block-meta.json", "demo/site/block-meta.json"),
fs.promises.copyFile("demo/api/schema.gql", "demo/admin/schema.gql"),
fs.promises.copyFile("demo/api/schema.gql", "demo/site/schema.gql"),
fs.promises.copyFile("demo/api/comet-config.json", "demo/site/comet-config.json"),
fs.promises.copyFile("demo/api/comet-config.json", "demo/admin/comet-config.json"),
fs.promises.copyFile("demo/api/src/comet-config.json", "demo/site/src/comet-config.json"),
fs.promises.copyFile("demo/api/src/comet-config.json", "demo/admin/src/comet-config.json"),
]);
})();
2 changes: 1 addition & 1 deletion demo/admin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ lang-compiled
graphql.generated.ts
block-meta.json
src/blocks.generated.ts
comet-config.json
src/comet-config.json
src/**/*.generated.ts
1 change: 0 additions & 1 deletion demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"generate-block-types:watch": "chokidar -s \"**/block-meta.json\" -c \"npm run generate-block-types\"",
"gql:types": "graphql-codegen",
"gql:watch": "graphql-codegen --watch",
"postinstall": "cd server && npm install",
"intl:compile": "run-p intl:compile:comet intl:compile:comet-demo",
"intl:compile:comet": "formatjs compile-folder --format simple --ast lang/comet-lang lang-compiled/comet-lang",
"intl:compile:comet-demo": "formatjs compile-folder --format simple --ast lang/comet-demo-lang lang-compiled/comet-demo-lang",
Expand Down
Loading

0 comments on commit b640c97

Please sign in to comment.