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

Release 2024-10-28_2 #9225

Merged
merged 69 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
52eee0a
Scaffold empty widget
luucvanderzee Oct 14, 2024
590020f
Add to toolbox
luucvanderzee Oct 14, 2024
c5e54f3
Create story
luucvanderzee Oct 14, 2024
9d203ab
Design widget desktop view (WIP)
luucvanderzee Oct 14, 2024
6eaf5c9
Translations updated by CI (extract-intl)
Oct 14, 2024
572c4e6
Tweak spacing
luucvanderzee Oct 14, 2024
e09ae47
_
luucvanderzee Oct 14, 2024
d68ba03
Merge branch 'master' into TAN-2781-spotlight-widget
luucvanderzee Oct 17, 2024
b7bcdd7
Fix layout on all screen sizeS
luucvanderzee Oct 17, 2024
b84a4e6
Tweak lineheight
luucvanderzee Oct 17, 2024
a336a0d
Add avatars
luucvanderzee Oct 17, 2024
593e05d
Add compulsory title
luucvanderzee Oct 17, 2024
763c6b3
Merge branch 'master' into TAN-2781-spotlight-widget
luucvanderzee Oct 18, 2024
5429a3b
_
luucvanderzee Oct 18, 2024
d9d71eb
_
luucvanderzee Oct 18, 2024
abba096
_
luucvanderzee Oct 18, 2024
592659b
Merge branch 'master' into TAN-2781-spotlight-widget
luucvanderzee Oct 22, 2024
99eaca5
_
luucvanderzee Oct 22, 2024
d30f85d
_
luucvanderzee Oct 22, 2024
c8228aa
Translations updated by CI (extract-intl)
Oct 22, 2024
a509169
Add shorter description in widget
luucvanderzee Oct 22, 2024
82e42d0
Make look slightly better on homepage
luucvanderzee Oct 22, 2024
a890de3
_
luucvanderzee Oct 22, 2024
4b337a7
Translations updated by CI (extract-intl)
Oct 22, 2024
65317cc
_
luucvanderzee Oct 22, 2024
3e53af8
WIP
luucvanderzee Oct 22, 2024
67e656a
Add state for when project is not selected yet
luucvanderzee Oct 22, 2024
2ca28af
_
luucvanderzee Oct 22, 2024
1c36c89
_
luucvanderzee Oct 23, 2024
eabddfa
Make border light up and add title to custom attributes
luucvanderzee Oct 23, 2024
726ab07
Allow customizing title and description
luucvanderzee Oct 23, 2024
45d6eff
Translations updated by CI (extract-intl)
Oct 23, 2024
df4f6aa
Allow projects and folders
luucvanderzee Oct 24, 2024
8e6b123
Fix select
luucvanderzee Oct 24, 2024
274d3d3
Change copy to project AND folder
luucvanderzee Oct 24, 2024
3017ab7
Fix insane caching problem
luucvanderzee Oct 24, 2024
c14268d
Fix folder link
luucvanderzee Oct 24, 2024
fa5edc7
Fix padding
luucvanderzee Oct 24, 2024
ff9b209
Translations updated by CI (extract-intl)
Oct 24, 2024
8fc436e
Rename widget to just spotlight
luucvanderzee Oct 24, 2024
74daa39
Rename Spotlight to CallToAction
luucvanderzee Oct 24, 2024
caf68b9
Other spacing improvements
luucvanderzee Oct 24, 2024
40d0ff6
Add new feature flag for homepage builder widgets
luucvanderzee Oct 24, 2024
48a0007
Hide widget if feature flag not enabled
luucvanderzee Oct 24, 2024
36c0c97
Translations updated by CI (extract-intl)
Oct 24, 2024
776fa97
Make go back button and title consistent with report builder
luucvanderzee Oct 25, 2024
50b36d6
Project description builder: move go back button and make title consi…
luucvanderzee Oct 25, 2024
5f6a4ee
Remove old go back button
luucvanderzee Oct 25, 2024
3506779
Use new locale select in homepage builder
luucvanderzee Oct 25, 2024
48accf2
Project description builder: also swap locale select
luucvanderzee Oct 25, 2024
bd62512
Remove old locale switcher
luucvanderzee Oct 25, 2024
08f4999
Replace old save buttons
luucvanderzee Oct 25, 2024
e190d40
Replace 'view' button
luucvanderzee Oct 25, 2024
b29b5d5
Translations updated by CI (extract-intl)
Oct 25, 2024
3ab8a4f
Fix spacing
luucvanderzee Oct 25, 2024
351000d
Merge branch 'TAN-2781-spotlight-widget' into TAN-2780-redesign-build…
luucvanderzee Oct 25, 2024
5c55ac2
Remove test
luucvanderzee Oct 25, 2024
7bfbcf5
Fix topbar tests
luucvanderzee Oct 25, 2024
2873b7e
Make homepage builder toolbox look like report builder one
luucvanderzee Oct 25, 2024
650bd36
Make project description builder toolbox look like report builder
luucvanderzee Oct 25, 2024
39fcc55
Translations updated by CI (extract-intl)
Oct 25, 2024
688cfa1
Also remove SectionTitle
luucvanderzee Oct 25, 2024
dc9248b
Only prefetch homepage layout and status counts if entering on homepage
luucvanderzee Oct 28, 2024
b57f96d
Merge pull request #9223 from CitizenLabDotCo/TAN-2856-performance-le…
luucvanderzee Oct 28, 2024
4fd79b4
Merge pull request #9215 from CitizenLabDotCo/TAN-2780-redesign-build…
luucvanderzee Oct 28, 2024
dd8d84a
Merge pull request #9224 from CitizenLabDotCo/TAN-2780-redesign-build…
luucvanderzee Oct 28, 2024
7c62978
Merge pull request #9097 from CitizenLabDotCo/TAN-2781-spotlight-widget
luucvanderzee Oct 28, 2024
3cb7305
Fix linter
luucvanderzee Oct 28, 2024
2b347fa
Merge pull request #9226 from CitizenLabDotCo/fix-linter
luucvanderzee Oct 28, 2024
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
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
Loading