Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into admin-generator-custo…
Browse files Browse the repository at this point in the history
…m-grid-actions
  • Loading branch information
jamesricky committed Apr 10, 2024
2 parents dc2f9ae + 20b2baf commit 114cabc
Show file tree
Hide file tree
Showing 164 changed files with 2,705 additions and 1,231 deletions.
16 changes: 16 additions & 0 deletions .changeset/beige-chefs-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@comet/eslint-config": major
---

Enforce PascalCase for enums

Changing the casing of an existing enum can be problematic, e.g., if the enum values are persisted in the database.
In such cases, the rule can be disabled like so

```diff
+ /* eslint-disable @typescript-eslint/naming-convention */
export enum ExampleEnum {
attr1 = "attr1",
}
+ /* eslint-enable @typescript-eslint/naming-convention */
```
21 changes: 21 additions & 0 deletions .changeset/chilled-walls-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@comet/eslint-config": major
---

Add the rule `@typescript-eslint/prefer-enum-initializers` to require enum initializers

```ts
//
enum ExampleEnum {
One = "One",
Two = "Two"
}
```

```ts
//
enum ExampleEnum {
One,
Two
}
```
8 changes: 8 additions & 0 deletions .changeset/curvy-moles-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin-theme": major
---

Rework `typographyOptions`

- Replace `typographyOptions` with `createTypographyOptions()` to enable using the theme's breakpoints for media queries
- Add new styles for `button` variant
21 changes: 21 additions & 0 deletions .changeset/eighty-owls-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@comet/admin-theme": major
---

Rework colors

- Rename `bluePalette` to `primaryPalette`
- Rename `neutrals` to `greyPalette`
- Remove `greenPalette`
- Remove `secondary` from `paletteOptions`
- Change colors in all palettes
- Change `text` colors
- Add `highlight` colors `purple`, `green`, `orange`, `yellow` and `red` to palette

Hint: To use the `highlight` colors without getting a type error, you must adjust the `vendors.d.ts` in your project:

```diff
+ /// <reference types="@comet/admin-theme" />

// ...
```
33 changes: 0 additions & 33 deletions .changeset/fair-snakes-leave.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/funny-bananas-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-api": minor
---

Provide a `User`-interface that allows module augmentation and hence storing additional data.
5 changes: 5 additions & 0 deletions .changeset/grumpy-poets-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": major
---

Change `Link` text styling
12 changes: 0 additions & 12 deletions .changeset/lazy-items-impress.md

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/long-items-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/cms-admin": minor
---

Remove "Re-login"-button from `CurrentUserProvider`

The button is already implemented in `createErrorDialogApolloLink()`. The correct arrangement of
the components in `App.tsx` (see migration guide) makes the double implementation needless.
5 changes: 5 additions & 0 deletions .changeset/nervous-sloths-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": minor
---

Add setting `signInUrl` to `createErrorDialogApolloLink`
34 changes: 34 additions & 0 deletions .changeset/plenty-cougars-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
"@comet/cms-site": minor
---

Add GraphQL fetch client

- `createGraphQLFetch`: simple graphql client around fetch, usage: createGraphQLFetch(fetch, url)(gql, variables)
- `type GraphQLFetch = <T, V>(query: string, variables?: V, init?: RequestInit) => Promise<T>`
- `gql` for tagging queries
- `createFetchWithDefaults` fetch decorator that adds default values (eg. headers or next.revalidate)
- `createFetchWithPreviewHeaders` fetch decorator that adds comet preview headers (based on SitePreviewData)

Example helper in application:
```
export const graphQLApiUrl = `${typeof window === "undefined" ? process.env.API_URL_INTERNAL : process.env.NEXT_PUBLIC_API_URL}/graphql`;
export function createGraphQLFetch(previewData?: SitePreviewData) {
return createGraphQLFetchLibrary(
createFetchWithDefaults(createFetchWithPreviewHeaders(fetch, previewData), { next: { revalidate: 15 * 60 } }),
graphQLApiUrl,
);
}
```

Usage example:
```
const graphqlFetch = createGraphQLFetch(previewData);
const data = await graphqlFetch<GQLExampleQuery, GQLExampleQueryVariables>(
exampleQuery,
{
exampleVariable: "foo"
}
);
```
5 changes: 5 additions & 0 deletions .changeset/polite-needles-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": minor
---

Add `breakpointsOptions` to theme
13 changes: 13 additions & 0 deletions .changeset/selfish-dolls-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@comet/cms-site": minor
---

Add new technique for blocks to load additional data at page level when using SSR

This works both server-side (SSR, SSG) and client-side (block preview).

New Apis:

- `recursivelyLoadBlockData`: used to call loaders for a block data tree
- `BlockLoader`: type of a loader function that is responsible for one block
- `useBlockPreviewFetch`: helper hook for block preview that creates client-side caching graphQLFetch/fetch
7 changes: 7 additions & 0 deletions .changeset/young-lies-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin-theme": major
---

Rework shadows

- Change shadows 1 - 4
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ SITE_PRELOGIN_PASSWORD=password
NEXT_PUBLIC_SITE_DOMAIN=main
NEXT_PUBLIC_SITE_LANGUAGES=en
NEXT_PUBLIC_SITE_DEFAULT_LANGUAGE=en
NEXT_PUBLIC_API_URL=$API_URL

# jaegertracing
JAEGER_UI_PORT=16686
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ jobs:
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/admin/lang/comet-lang"

- name: "Demo Admin: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-demo-lang
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/admin/lang/comet-demo-lang"

- name: "Demo Site: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-demo-lang
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/site/lang/comet-demo-lang"

- uses: pnpm/action-setup@v2
with:
version: 8
Expand All @@ -62,23 +48,37 @@ jobs:
with:
cwd: "./demo/admin/lang/comet-lang"

- name: "Demo Admin: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-demo-lang
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/admin/lang/comet-demo-lang"

- name: "Demo Admin: Extract i18n strings"
run: |
cd demo/admin
pnpm run intl:extract
cp -r lang-extracted/* lang/comet-demo-lang/admin
- name: "Demo Admin: Update translatable strings"
uses: EndBug/add-and-commit@v9
with:
cwd: "./demo/admin/lang/comet-demo-lang"

- name: "Demo Site: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-demo-lang
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/site/lang/comet-demo-lang"

- name: "Demo Site: Extract i18n strings"
run: |
cd demo/site
pnpm run intl:extract
cp -r lang-extracted/* lang/comet-demo-lang/site
- name: "Demo Admin: Update translatable strings"
uses: EndBug/add-and-commit@v9
with:
cwd: "./demo/admin/lang/comet-demo-lang"

- name: "Demo Site: Update translatable strings"
uses: EndBug/add-and-commit@v9
with:
Expand Down
1 change: 0 additions & 1 deletion demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
"dotenv-cli": "^4.0.0",
"eslint": "^8.0.0",
"eslint-plugin-graphql": "^4.0.0",
"graphql-request": "^3.0.0",
"kill-port": "^2.0.1",
"npm-run-all": "^4.1.5",
"pascal-case": "^3.0.0",
Expand Down
64 changes: 32 additions & 32 deletions demo/admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,36 @@ class App extends React.Component {
public render(): JSX.Element {
return (
<ApolloProvider client={apolloClient}>
<CurrentUserProvider>
<SitesConfigProvider
<SitesConfigProvider
value={{
configs: config.sitesConfig,
resolveSiteConfigForScope: (configs, scope: ContentScope) => configs[scope.domain],
}}
>
<DamConfigProvider
value={{
configs: config.sitesConfig,
resolveSiteConfigForScope: (configs, scope: ContentScope) => configs[scope.domain],
scopeParts: ["domain"],
additionalToolbarItems: <ImportFromUnsplash />,
importSources: {
unsplash: {
label: <FormattedMessage id="dam.importSource.unsplash.label" defaultMessage="Unsplash" />,
},
},
}}
>
<DamConfigProvider
value={{
scopeParts: ["domain"],
additionalToolbarItems: <ImportFromUnsplash />,
importSources: {
unsplash: {
label: <FormattedMessage id="dam.importSource.unsplash.label" defaultMessage="Unsplash" />,
},
},
<DependenciesConfigProvider
entityDependencyMap={{
Page,
Link,
News: NewsDependency,
DamFile: createDamFileDependency(),
}}
>
<DependenciesConfigProvider
entityDependencyMap={{
Page,
Link,
News: NewsDependency,
DamFile: createDamFileDependency(),
}}
>
<IntlProvider locale="en" messages={getMessages()}>
<LocaleProvider resolveLocaleForScope={(scope: ContentScope) => scope.domain}>
<MuiThemeProvider theme={theme}>
<IntlProvider locale="en" messages={getMessages()}>
<LocaleProvider resolveLocaleForScope={(scope: ContentScope) => scope.domain}>
<MuiThemeProvider theme={theme}>
<ErrorDialogHandler />
<CurrentUserProvider>
<RouterBrowserRouter>
<DndProvider backend={HTML5Backend}>
<SnackbarProvider>
Expand Down Expand Up @@ -131,19 +132,18 @@ class App extends React.Component {
</Switch>
)}
</ContentScopeProvider>
<ErrorDialogHandler />
</React.Fragment>
</CmsBlockContextProvider>
</SnackbarProvider>
</DndProvider>
</RouterBrowserRouter>
</MuiThemeProvider>
</LocaleProvider>
</IntlProvider>
</DependenciesConfigProvider>
</DamConfigProvider>
</SitesConfigProvider>
</CurrentUserProvider>
</CurrentUserProvider>
</MuiThemeProvider>
</LocaleProvider>
</IntlProvider>
</DependenciesConfigProvider>
</DamConfigProvider>
</SitesConfigProvider>
</ApolloProvider>
);
}
Expand Down
8 changes: 8 additions & 0 deletions demo/admin/src/common/MasterMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { categoryToUrlParam, pageTreeCategories, urlParamToCategory } from "@src
import { PredefinedPage } from "@src/predefinedPage/PredefinedPage";
import ProductCategoriesPage from "@src/products/categories/ProductCategoriesPage";
import { ProductsPage as FutureProductsPage } from "@src/products/future/ProductsPage";
import { ProductsWithLowPricePage as FutureProductsWithLowPricePage } from "@src/products/future/ProductsWithLowPricePage";
import { ProductsPage } from "@src/products/generated/ProductsPage";
import { ManufacturersPage as ManufacturersHandmadePage } from "@src/products/ManufacturersPage";
import ProductsHandmadePage from "@src/products/ProductsPage";
Expand Down Expand Up @@ -173,6 +174,13 @@ export const masterMenuData: MasterMenuData = [
component: FutureProductsPage,
},
},
{
primary: <FormattedMessage id="menu.productsFuture" defaultMessage="Products with low price Future" />,
route: {
path: "/products-with-low-price-future",
component: FutureProductsWithLowPricePage,
},
},
{
primary: <FormattedMessage id="menu.products" defaultMessage="Products" />,
route: {
Expand Down
Loading

0 comments on commit 114cabc

Please sign in to comment.