Skip to content

Commit

Permalink
Merge pull request #9225 from CitizenLabDotCo/master
Browse files Browse the repository at this point in the history
Release 2024-10-28_2
  • Loading branch information
luucvanderzee authored Oct 28, 2024
2 parents 7a66b4c + 2b347fa commit 0903a33
Show file tree
Hide file tree
Showing 117 changed files with 978 additions and 833 deletions.
12 changes: 12 additions & 0 deletions back/config/schemas/settings.schema.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,18 @@
"allowed": { "type": "boolean", "default": false },
"enabled": { "type": "boolean", "default": false }
}
},

"new_homepage_widgets": {
"type": "object",
"title": "New homepage widgets",
"description": "New homepage widgets (sticky homepages tandem). Feature flagged until pricing plan stuff decided.",
"additionalProperties": false,
"required": ["allowed", "enabled"],
"properties": {
"allowed": { "type": "boolean", "default": false },
"enabled": { "type": "boolean", "default": false }
}
}
},
"dependencies": {
Expand Down
4 changes: 4 additions & 0 deletions back/engines/commercial/multi_tenancy/db/seeds/tenants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ def create_localhost_tenant
enabled: true,
allowed: true,
issuer: '' # Change this value to 'https://fake-sso.onrender.com' to test with the deployed version of the Fake SSO
},
new_homepage_widgets: {
enabled: true,
allowed: true
}
})
)
Expand Down
Binary file added front/.storybook/static/images/city.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 1 addition & 11 deletions front/app/api/admin_publications/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ export interface IQueryParameters {
include_publications?: boolean;
}

/**
* The sole purpose of this interface is to allow widening the types
* in external modules, by reopening the interface and adding other key-values
*/
export interface IAdminPublicationTypeMap {
project: 'project';
folder: 'folder';
}

export type AdminPublicationType =
IAdminPublicationTypeMap[keyof IAdminPublicationTypeMap];
export type AdminPublicationType = 'project' | 'folder';

/**
Data structure to handle the ordering of published projects and folders.
Expand Down
1 change: 1 addition & 0 deletions front/app/api/app_configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export interface IAppConfigurationSettings {
prescreening?: AppConfigurationFeature;
prescreening_ideation?: AppConfigurationFeature;
input_cosponsorship?: AppConfigurationFeature;
new_homepage_widgets?: AppConfigurationFeature;
}

export type TAppConfigurationSettingCore = keyof IAppConfigurationSettingsCore;
Expand Down
2 changes: 1 addition & 1 deletion front/app/api/avatars/__mocks__/_mockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getOrigin } from 'utils/storybook/getOrigin';

import { IAvatarData } from '../types';

const image = `${getOrigin()}/images/female_avatar_5`;
const image = `${getOrigin()}/images/female_avatar_5.jpg`;

export const avatarsData: IAvatarData[] = [
{
Expand Down
5 changes: 4 additions & 1 deletion front/app/component-library/components/Title/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type TitleProps = {
fontWeight?: FontWeight;
fontStyle?: FontStyle;
textAlign?: TextAlign;
lineHeight?: string;
} & BoxMarginProps &
BoxPaddingProps &
BoxPositionProps &
Expand All @@ -53,7 +54,7 @@ export type TitleProps = {
React.HTMLAttributes<HTMLHeadingElement>;

const StyledTitle = styled(Box)`
line-height: 1.3;
line-height: ${({ lineHeight }) => lineHeight ?? '1.3'};
${isRtl`direction: rtl;`}
Expand Down Expand Up @@ -111,6 +112,7 @@ const Title: React.FC<TitleProps> = ({
as,
fontSize,
fontWeight,
lineHeight,
...props
}) => {
const mb = props.mb || props.my || props.m || '16px';
Expand All @@ -123,6 +125,7 @@ const Title: React.FC<TitleProps> = ({
fontSize={fontSize}
fontWeight={fontWeight}
mb={mb}
lineHeight={lineHeight}
{...props}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { SupportedLocale } from 'typings';

import messages from 'containers/ProjectDescriptionBuilder/messages';

import contentBuilderMessages from 'components/admin/ContentBuilder/messages';
import Container from 'components/admin/ContentBuilder/Toolbox/Container';
import DraggableElement from 'components/admin/ContentBuilder/Toolbox/DraggableElement';
import SectionTitle from 'components/admin/ContentBuilder/Toolbox/SectionTitle';
import Section from 'components/admin/ContentBuilder/Toolbox/Section';
import AboutBox from 'components/admin/ContentBuilder/Widgets/AboutBox';
import AccordionMultiloc from 'components/admin/ContentBuilder/Widgets/AccordionMultiloc';
import ButtonMultiloc from 'components/admin/ContentBuilder/Widgets/ButtonMultiloc';
Expand All @@ -19,7 +18,7 @@ import ThreeColumn from 'components/admin/ContentBuilder/Widgets/ThreeColumn';
import TwoColumn from 'components/admin/ContentBuilder/Widgets/TwoColumn';
import WhiteSpace from 'components/admin/ContentBuilder/Widgets/WhiteSpace';

import { FormattedMessage, useIntl } from 'utils/cl-intl';
import { useIntl } from 'utils/cl-intl';

import InfoWithAccordions from '../CraftSections/InfoWithAccordions';

Expand All @@ -34,95 +33,92 @@ const ProjectDescriptionBuilderToolbox = ({

return (
<Container>
<SectionTitle>
<FormattedMessage {...messages.sections} />
</SectionTitle>
<DraggableElement
id="e2e-draggable-image-text-cards"
component={<ImageTextCards />}
icon="section-image-text"
label={formatMessage(messages.imageTextCards)}
/>
<DraggableElement
id="e2e-draggable-info-accordions"
component={<InfoWithAccordions />}
icon="section-info-accordion"
label={formatMessage(messages.infoWithAccordions)}
/>
<SectionTitle>
<FormattedMessage {...contentBuilderMessages.layout} />
</SectionTitle>
<DraggableElement
id="e2e-draggable-two-column"
component={<TwoColumn columnLayout="1-1" />}
icon="layout-2column-1"
label={formatMessage(TwoColumn.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-three-column"
component={<ThreeColumn />}
icon="layout-3column"
label={formatMessage(ThreeColumn.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-white-space"
component={<WhiteSpace size="small" />}
icon="layout-white-space"
label={formatMessage(WhiteSpace.craft.custom.title)}
/>
<SectionTitle>
<FormattedMessage {...contentBuilderMessages.content} />
</SectionTitle>
<DraggableElement
id="e2e-draggable-text"
component={<TextMultiloc />}
icon="text"
label={formatMessage(TextMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-button"
component={
<ButtonMultiloc
text={{}}
url={''}
type={'primary'}
alignment={'left'}
/>
}
icon="button"
label={formatMessage(ButtonMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-image"
component={<ImageMultiloc />}
icon="image"
label={formatMessage(ImageMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-iframe"
component={
<IframeMultiloc
url=""
height={500}
hasError={false}
selectedLocale={selectedLocale}
/>
}
icon="code"
label={formatMessage(IframeMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-about-box"
component={<AboutBox />}
icon="info-solid"
label={formatMessage(AboutBox.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-accordion"
component={<AccordionMultiloc title={{}} text={{}} />}
icon="accordion"
label={formatMessage(AccordionMultiloc.craft.custom.title)}
/>
<Section>
<DraggableElement
id="e2e-draggable-image-text-cards"
component={<ImageTextCards />}
icon="section-image-text"
label={formatMessage(messages.imageTextCards)}
/>
<DraggableElement
id="e2e-draggable-info-accordions"
component={<InfoWithAccordions />}
icon="section-info-accordion"
label={formatMessage(messages.infoWithAccordions)}
/>
</Section>
<Section>
<DraggableElement
id="e2e-draggable-two-column"
component={<TwoColumn columnLayout="1-1" />}
icon="layout-2column-1"
label={formatMessage(TwoColumn.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-three-column"
component={<ThreeColumn />}
icon="layout-3column"
label={formatMessage(ThreeColumn.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-white-space"
component={<WhiteSpace size="small" />}
icon="layout-white-space"
label={formatMessage(WhiteSpace.craft.custom.title)}
/>
</Section>
<Section>
<DraggableElement
id="e2e-draggable-text"
component={<TextMultiloc />}
icon="text"
label={formatMessage(TextMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-button"
component={
<ButtonMultiloc
text={{}}
url={''}
type={'primary'}
alignment={'left'}
/>
}
icon="button"
label={formatMessage(ButtonMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-image"
component={<ImageMultiloc />}
icon="image"
label={formatMessage(ImageMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-iframe"
component={
<IframeMultiloc
url=""
height={500}
hasError={false}
selectedLocale={selectedLocale}
/>
}
icon="code"
label={formatMessage(IframeMultiloc.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-about-box"
component={<AboutBox />}
icon="info-solid"
label={formatMessage(AboutBox.craft.custom.title)}
/>
<DraggableElement
id="e2e-draggable-accordion"
component={<AccordionMultiloc title={{}} text={{}} />}
icon="accordion"
label={formatMessage(AccordionMultiloc.craft.custom.title)}
/>
</Section>
</Container>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Editor } from '@craftjs/core';
import { IProjectDescriptionBuilderData } from 'api/project_description_builder/types';

import clHistory from 'utils/cl-router/history';
import { render, screen, fireEvent, act, within } from 'utils/testUtils/rtl';
import { render, screen, act, within, fireEvent } from 'utils/testUtils/rtl';

import ProjectDescriptionBuilderTopBar from '.';

Expand Down Expand Up @@ -237,9 +237,9 @@ describe('ProjectDescriptionBuilderTopBar', () => {
expect(screen.queryByText('en')).not.toBeInTheDocument();
});

it('renders locale switcher when there is only one locale', () => {
it('renders locale switcher when there is more than one locale', () => {
mockLocalesData = ['en', 'fr-FR'];
render(
const { container } = render(
<Editor>
<ProjectDescriptionBuilderTopBar
selectedLocale="en"
Expand All @@ -250,12 +250,13 @@ describe('ProjectDescriptionBuilderTopBar', () => {
/>
</Editor>
);
expect(screen.getByText('en')).toBeInTheDocument();
expect(container.querySelector('#e2e-locale-select')).toBeInTheDocument();
});

it('calls onSelectLocale correctly when the locale is changed', () => {
mockLocalesData = ['en', 'fr-FR'];
const onSelectLocale = jest.fn();
render(
const { container } = render(
<Editor>
<ProjectDescriptionBuilderTopBar
selectedLocale="en"
Expand All @@ -266,7 +267,12 @@ describe('ProjectDescriptionBuilderTopBar', () => {
/>
</Editor>
);
fireEvent.click(screen.getByText('fr-FR'));

expect(container.querySelector('#e2e-locale-select')).toBeInTheDocument();

fireEvent.change(container.querySelector('#e2e-locale-select'), {
target: { value: 'fr-FR' },
});
expect(onSelectLocale).toHaveBeenCalledWith({
editorData: {},
locale: 'fr-FR',
Expand Down
Loading

0 comments on commit 0903a33

Please sign in to comment.