Skip to content

Commit

Permalink
Merge main into next
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 20, 2025
2 parents 520cc0b + 2322738 commit 32ad6c5
Show file tree
Hide file tree
Showing 114 changed files with 5,752 additions and 205 deletions.
5 changes: 0 additions & 5 deletions .changeset/afraid-clocks-juggle.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/clever-cougars-glow.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/eighty-goats-beam.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/famous-pianos-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": patch
---

Fix display of warnings for forms that use both form-level and field-level validation
5 changes: 0 additions & 5 deletions .changeset/friendly-seas-yawn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/healthy-fireants-behave.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/metal-bees-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-api": patch
---

Add fallback values for users created via ID token
5 changes: 0 additions & 5 deletions .changeset/nine-roses-reflect.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/sharp-monkeys-cry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shiny-mangos-report.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/sixty-radios-switch.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strong-bees-breathe.md

This file was deleted.

3 changes: 2 additions & 1 deletion demo/admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { css, Global } from "@emotion/react";
import { createApolloClient } from "@src/common/apollo/createApolloClient";
import { ConfigProvider, createConfig } from "@src/config";
import { ContentScope } from "@src/site-configs";
import { theme } from "@src/theme";
import { HTML5toTouch } from "rdndmb-html5-to-touch";
import { DndProvider } from "react-dnd-multi-backend";
Expand Down Expand Up @@ -99,7 +100,7 @@ export function App() {
}}
>
<IntlProvider locale="en" messages={getMessages()}>
<LocaleProvider resolveLocaleForScope={(scope) => scope.domain}>
<LocaleProvider resolveLocaleForScope={(scope: ContentScope) => scope.language}>
<MuiThemeProvider theme={theme}>
<DndProvider options={HTML5toTouch}>
<SnackbarProvider>
Expand Down
6 changes: 5 additions & 1 deletion demo/admin/src/common/ContentScopeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ export const ContentScopeProvider = ({ children }: Pick<ContentScopeProviderProp
language: { value: contentScope.language, label: contentScope.language.toUpperCase() },
}));

if (user.allowedContentScopes.length === 0) {
throw new Error("User does not have access to any scopes.");
}

return (
<ContentScopeProviderLibrary<ContentScope> values={values} defaultValue={{ domain: "main", language: "en" }}>
<ContentScopeProviderLibrary<ContentScope> values={values} defaultValue={userContentScopes[0]}>
{children}
</ContentScopeProviderLibrary>
);
Expand Down
1 change: 1 addition & 0 deletions demo/admin/src/common/blocks/LayoutBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const LayoutBlock = createCompositeBlock(
<Field name="layout" component={FinalFormLayoutSelect} layouts={layoutOptions} fullWidth />
</BlocksFinalForm>
),
extractTextContents: () => [],
}),
title: <FormattedMessage id="layoutBlock.layout" defaultMessage="Layout" />,
},
Expand Down
103 changes: 103 additions & 0 deletions demo/admin/src/documents/pages/EditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
BlockAdminComponentRoot,
BlockAdminTabLabel,
BlockPreviewWithTabs,
ContentGenerationConfigProvider,
ContentScopeIndicator,
createUsePage,
openSitePreviewWindow,
Expand Down Expand Up @@ -119,6 +120,7 @@ export const EditPage = ({ id }: Props) => {

return (
<AzureAiTranslatorProvider showApplyTranslationDialog={true} enabled={true}>
<<<<<<< HEAD
{hasChanges && (
<RouterPrompt
message={(location) => {
Expand Down Expand Up @@ -208,6 +210,107 @@ export const EditPage = ({ id }: Props) => {
</BlockPreviewWithTabs>
</MainContent>
{dialogs}
=======
<ContentGenerationConfigProvider
seo={{
getRelevantContent: () => {
if (!pageState || !pageState.document) return [];

return PageContentBlock.extractTextContents?.(pageState.document.content, { includeInvisibleContent: false }) ?? [];
},
}}
>
{hasChanges && (
<RouterPrompt
message={(location) => {
if (location.pathname.startsWith(match.url)) return true; //we navigated within our self
return intl.formatMessage({
id: "editPage.discardChanges",
defaultMessage: "Discard unsaved changes?",
});
}}
saveAction={async () => {
try {
await handleSavePage();
return true;
} catch {
return false;
}
}}
/>
)}
<Toolbar scopeIndicator={<ContentScopeIndicator />}>
<ToolbarItem>
<IconButton onClick={stackApi?.goBack} size="large">
<ArrowLeft />
</IconButton>
</ToolbarItem>
<PageName pageId={id} />
<FillSpace />
<ToolbarActions>
<Stack direction="row" spacing={1}>
<Button
startIcon={<Preview />}
variant="textDark"
disabled={!pageState}
onClick={() => {
openSitePreviewWindow(pageState.path, contentScopeMatch.url);
}}
>
<FormattedMessage id="pages.pages.page.edit.preview" defaultMessage="Web preview" />
</Button>
{pageSaveButton}
</Stack>
</ToolbarActions>
</Toolbar>
<MainContent disablePaddingBottom>
<BlockPreviewWithTabs previewUrl={previewUrl} previewState={previewState} previewApi={previewApi}>
{[
{
key: "content",
label: (
<AdminTabLabel isValid={rootBlocksApi.content.isValid}>
<FormattedMessage id="generic.blocks" defaultMessage="Blocks" />
</AdminTabLabel>
),
content: (
<AdminComponentRoot
title={intl.formatMessage({ id: "pages.pages.page.edit.pageBlocks.title", defaultMessage: "Page" })}
>
{rootBlocksApi.content.adminUI}
</AdminComponentRoot>
),
},
{
key: "stage",
label: (
<AdminTabLabel isValid={rootBlocksApi.stage.isValid}>
<FormattedMessage id="pages.page.edit.stage" defaultMessage="Stage" />
</AdminTabLabel>
),
content: (
<AdminComponentRoot
title={intl.formatMessage({ id: "pages.pages.page.edit.stage.title", defaultMessage: "Stage" })}
>
{rootBlocksApi.stage.adminUI}
</AdminComponentRoot>
),
},
{
key: "config",
label: (
<AdminTabLabel isValid={rootBlocksApi.seo.isValid}>
<FormattedMessage id="pages.pages.page.edit.config" defaultMessage="Config" />
</AdminTabLabel>
),
content: rootBlocksApi.seo.adminUI,
},
]}
</BlockPreviewWithTabs>
</MainContent>
{dialogs}
</ContentGenerationConfigProvider>
>>>>>>> main
</AzureAiTranslatorProvider>
);
};
10 changes: 10 additions & 0 deletions demo/api/block-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,16 @@
"name": "scope",
"kind": "Json",
"nullable": true
},
{
"name": "altText",
"kind": "String",
"nullable": true
},
{
"name": "title",
"kind": "String",
"nullable": true
}
]
},
Expand Down
12 changes: 8 additions & 4 deletions demo/api/src/content-generation/content-generation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import { Injectable } from "@nestjs/common";
export class ContentGenerationService implements ContentGenerationServiceInterface {
constructor(private readonly openAiContentGenerationService: AzureOpenAiContentGenerationService) {}

async generateAltText(fileId: string) {
return this.openAiContentGenerationService.generateAltText(fileId);
async generateAltText(fileId: string, options?: { language: string }) {
return this.openAiContentGenerationService.generateAltText(fileId, options);
}

async generateImageTitle(fileId: string) {
return this.openAiContentGenerationService.generateImageTitle(fileId);
async generateImageTitle(fileId: string, options?: { language: string }) {
return this.openAiContentGenerationService.generateImageTitle(fileId, options);
}

async generateSeoTags(content: string, options: { language: string }) {
return this.openAiContentGenerationService.generateSeoTags(content, options);
}
}
21 changes: 19 additions & 2 deletions demo/site-pages/src/common/blocks/AccordionItemBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const AccordionItemBlock = withPreview(
<AnimatedChevron href="/assets/icons/chevron-down.svg#chevron-down" $isExpanded={isExpanded} />
</IconWrapper>
</TitleWrapper>
<ContentWrapper aria-hidden={!isExpanded}>
<ContentWrapperInner $isExpanded={isExpanded}>
<ContentWrapper aria-hidden={!isExpanded} $isExpanded={isExpanded}>
<ContentWrapperInner>
<AccordionContentBlock data={content} />
</ContentWrapperInner>
</ContentWrapper>
Expand Down Expand Up @@ -83,6 +83,7 @@ const AnimatedChevron = styled(SvgUse)<{ $isExpanded: boolean }>`
transition: transform 0.4s ease;
`;

<<<<<<< HEAD
const ContentWrapper = styled.div`
overflow: hidden;
`;
Expand All @@ -94,14 +95,30 @@ const ContentWrapperInner = styled.div<{ $isExpanded: boolean }>`
transition:
margin-top 0.8s ease-out 0.3s,
opacity 0.3s linear;
=======
const ContentWrapper = styled.div<{ $isExpanded: boolean }>`
position: relative;
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.5s ease-out;
>>>>>>> main

${({ $isExpanded }) =>
$isExpanded &&
css`
<<<<<<< HEAD
margin-top: 0;
opacity: 1;
transition:
margin-top 0.5s ease-out,
opacity 0.3s linear 0.4s;
=======
grid-template-rows: 1fr;
padding-bottom: ${({ theme }) => theme.spacing.S300};
>>>>>>> main
`}
`;
const ContentWrapperInner = styled.div`
overflow: hidden;
`;
5 changes: 5 additions & 0 deletions demo/site/cache-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,9 @@ export default class CacheHandler {
}
fallbackCache.set(key, value, { size: stringData.length });
}

async revalidateTag(tags: string | string[]): Promise<void> {
if (tags.length === 0) return;
console.warn("CacheHandler.revalidateTag", tags);
}
}
21 changes: 19 additions & 2 deletions demo/site/src/common/blocks/AccordionItemBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const AccordionItemBlock = withPreview(
<AnimatedChevron href="/assets/icons/chevron-down.svg#root" $isExpanded={isExpanded} />
</IconWrapper>
</TitleWrapper>
<ContentWrapper aria-hidden={!isExpanded}>
<ContentWrapperInner $isExpanded={isExpanded}>
<ContentWrapper aria-hidden={!isExpanded} $isExpanded={isExpanded}>
<ContentWrapperInner>
<AccordionContentBlock data={content} />
</ContentWrapperInner>
</ContentWrapper>
Expand Down Expand Up @@ -84,6 +84,7 @@ const AnimatedChevron = styled(SvgUse)<{ $isExpanded: boolean }>`
transition: transform 0.4s ease;
`;

<<<<<<< HEAD
const ContentWrapper = styled.div`
overflow: hidden;
`;
Expand All @@ -95,14 +96,30 @@ const ContentWrapperInner = styled.div<{ $isExpanded: boolean }>`
transition:
margin-top 0.8s ease-out 0.3s,
opacity 0.3s linear;
=======
const ContentWrapper = styled.div<{ $isExpanded: boolean }>`
position: relative;
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.5s ease-out;
>>>>>>> main

${({ $isExpanded }) =>
$isExpanded &&
css`
<<<<<<< HEAD
margin-top: 0;
opacity: 1;
transition:
margin-top 0.5s ease-out,
opacity 0.3s linear 0.4s;
=======
grid-template-rows: 1fr;
padding-bottom: ${({ theme }) => theme.spacing.S300};
>>>>>>> main
`}
`;
const ContentWrapperInner = styled.div`
overflow: hidden;
`;
Loading

0 comments on commit 32ad6c5

Please sign in to comment.