From 6aae6031c7fd548ef2023a9b7deb9f73e244126a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 28 May 2024 10:23:47 +0200 Subject: [PATCH 01/42] Fix test script in monorepo root (#6051) --- package.json | 3 ++- packages/volto/news/6051.internal | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 packages/volto/news/6051.internal diff --git a/package.json b/package.json index 6d58ee59e1..dccd226ba0 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "start:project": "pnpm --filter plone run start", "lint": "pnpm build:all && eslint --max-warnings=0 '{apps,packages}/**/*.{js,jsx,ts,tsx}'", "lint:volto": "pnpm --filter @plone/volto run lint", - "test": "pnpm --filter @plone/volto run test:ci", + "test": "pnpm --filter @plone/volto run test", + "test:ci": "pnpm --filter @plone/volto run test:ci", "i18n": "pnpm --filter @plone/volto run i18n", "i18n:ci": "pnpm --filter @plone/volto i18n:ci", "prettier": "prettier --check '{apps,packages}/**/*.{js,jsx,ts,tsx}'", diff --git a/packages/volto/news/6051.internal b/packages/volto/news/6051.internal new file mode 100644 index 0000000000..dbda58fedf --- /dev/null +++ b/packages/volto/news/6051.internal @@ -0,0 +1 @@ +Fix test script in monorepo root @sneridagh From 386dc7f628a199bf3ce00f07b5755f517fce6be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 28 May 2024 16:47:09 +0200 Subject: [PATCH 02/42] [client] Fix login mutation (#6053) --- packages/client/news/6053.bugfix | 1 + packages/client/src/client.ts | 6 +-- .../client/src/restapi/login/post.test.tsx | 46 +++++++++++++++++++ packages/client/src/restapi/login/post.ts | 12 +++-- 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 packages/client/news/6053.bugfix create mode 100644 packages/client/src/restapi/login/post.test.tsx diff --git a/packages/client/news/6053.bugfix b/packages/client/news/6053.bugfix new file mode 100644 index 0000000000..ce7c60c564 --- /dev/null +++ b/packages/client/news/6053.bugfix @@ -0,0 +1 @@ +Fixed login mutation @sneridagh diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index 7e8fee816f..93fdb7e4b6 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -1,5 +1,5 @@ import { - loginQuery as _loginQuery, + loginMutation as _loginMutation, login as _login, } from './restapi/login/post'; import type { LoginArgs } from './restapi/login/post'; @@ -145,7 +145,7 @@ export default class PloneClient { /* Initialization queries */ - loginQuery = queryWithConfig(_loginQuery, this.getConfig); + loginMutation = mutationWithConfig(_loginMutation, this.getConfig); /* Content queries @@ -546,7 +546,7 @@ export default class PloneClient { Initialization hooks */ - useLogin = queryHookFromQuery(this.loginQuery); + useLogin = mutationHookFromMutation(this.loginMutation); /* Actions hooks diff --git a/packages/client/src/restapi/login/post.test.tsx b/packages/client/src/restapi/login/post.test.tsx new file mode 100644 index 0000000000..1c83f23b61 --- /dev/null +++ b/packages/client/src/restapi/login/post.test.tsx @@ -0,0 +1,46 @@ +import { setup, teardown } from '../../resetFixture'; +import { beforeEach } from 'vitest'; +import { expect, test } from 'vitest'; +import PloneClient from '../../client'; +import { login, loginMutation } from './post'; + +const cli = PloneClient.initialize({ + apiPath: 'http://localhost:55001/plone', +}); + +beforeEach(async () => { + await setup(); +}); + +afterEach(async () => { + await teardown(); +}); + +describe('Login', () => { + test('login request function', async () => { + const options = loginMutation({ config: cli.config }); + expect(options.mutationKey).toEqual(['login']); + expect(options.mutationFn).toBeTypeOf('function'); + + const result = await login({ + username: 'admin', + password: 'secret', + config: cli.config, + }); + expect(result).toBeTypeOf('object'); + expect(result.token).toBeTypeOf('string'); + }); + + test('loginMutation options factories', async () => { + const options = loginMutation({ config: cli.config }); + expect(options.mutationKey).toEqual(['login']); + expect(options.mutationFn).toBeTypeOf('function'); + + const login = await options.mutationFn({ + username: 'admin', + password: 'secret', + }); + expect(login).toBeTypeOf('object'); + expect(login.token).toBeTypeOf('string'); + }); +}); diff --git a/packages/client/src/restapi/login/post.ts b/packages/client/src/restapi/login/post.ts index d2dd58c963..5d893fef9f 100644 --- a/packages/client/src/restapi/login/post.ts +++ b/packages/client/src/restapi/login/post.ts @@ -1,7 +1,10 @@ import { Login } from '@plone/types'; import { apiRequest, ApiRequestParams } from '../../API'; import { z } from 'zod'; -import { PloneClientConfigSchema } from '../../validation/config'; +import { + PloneClientConfig, + PloneClientConfigSchema, +} from '../../validation/config'; export const loginArgsSchema = z.object({ username: z.string(), @@ -32,7 +35,8 @@ export const login = ({ return apiRequest('post', '/@login', options); }; -export const loginQuery = ({ username, password, config }: LoginArgs) => ({ - queryKey: [username, 'login'], - queryFn: () => login({ username, password, config }), +export const loginMutation = ({ config }: { config: PloneClientConfig }) => ({ + mutationKey: ['login'], + mutationFn: ({ username, password }: Omit) => + login({ username, password, config }), }); From f77357f1f1eeab1c1d81f72f0174dcbba7badd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 28 May 2024 20:05:59 +0200 Subject: [PATCH 03/42] [client] Remove the custom runner with bare vitest config (#6056) --- packages/client/news/6056.internal | 1 + packages/client/package.json | 3 +- packages/client/testRunner.js | 54 ------------------------------ packages/client/vitest.config.ts | 2 ++ 4 files changed, 4 insertions(+), 56 deletions(-) create mode 100644 packages/client/news/6056.internal delete mode 100644 packages/client/testRunner.js diff --git a/packages/client/news/6056.internal b/packages/client/news/6056.internal new file mode 100644 index 0000000000..e0091b0624 --- /dev/null +++ b/packages/client/news/6056.internal @@ -0,0 +1 @@ +Remove custom test runner, using `vitest` config instead @sneridagh diff --git a/packages/client/package.json b/packages/client/package.json index 92bd030886..6d7a5020b0 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -48,8 +48,7 @@ "scripts": { "build": "parcel build", "build:force": "parcel build --no-cache", - "test": "node testRunner.js", - "vitest": "vitest", + "test": "vitest", "check-ts": "tsc --project tsconfig.json", "coverage": "vitest run --coverage --no-threads", "dry-release": "release-it --dry-run", diff --git a/packages/client/testRunner.js b/packages/client/testRunner.js deleted file mode 100644 index d3d9870b9c..0000000000 --- a/packages/client/testRunner.js +++ /dev/null @@ -1,54 +0,0 @@ -import fs from 'fs'; -import glob from 'glob'; -import { execSync } from 'child_process'; - -// get directories in src -const directories = fs - .readdirSync('./src/restapi', { withFileTypes: true }) - .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name); - -/* - For each directory, run vitest sequentially. - - This is done to make sure that the tests are isolated from which other. - - Using no-threads parameter removes the per-module isolation as well, but - not using the no-threads parameter causes tests to fail beccause there - is no isolation at the test DB level and different tests can interefere - with each other's mutations. -*/ - -directories.forEach((dir) => { - glob(`./src/${dir}/*/.test.tsx`, (err, matches) => { - if (err) { - console.error(err); - return; - } - - // if there are any matches, run vitest on this directory - if (matches.length > 0) { - console.log(`Running vitest on src/${dir}`); - execSync(`pnpm vitest "src/${dir}/*/.test.{ts,tsx,js,jsx}"`, { - stdio: 'inherit', - }); - } - }); -}); - -directories.forEach((dir) => { - glob(`./src/restapi/${dir}/**/*.test.tsx`, (err, matches) => { - if (err) { - console.error(err); - throw Error(err); - } - - // if there are any matches, run vitest on this directory - if (matches.length > 0) { - console.log(`Running vitest on src/${dir}`); - execSync(`pnpm vitest run src/restapi/${dir}`, { - stdio: 'inherit', - }); - } - }); -}); diff --git a/packages/client/vitest.config.ts b/packages/client/vitest.config.ts index 02c3465eae..c878428dd4 100644 --- a/packages/client/vitest.config.ts +++ b/packages/client/vitest.config.ts @@ -5,6 +5,8 @@ export default defineConfig({ globals: true, environment: 'jsdom', setupFiles: './setupTesting.ts', + fileParallelism: false, + pool: 'forks', poolOptions: { threads: { singleThread: true, From 524a712bba725bf7b00a9d2c25352bc772c3b588 Mon Sep 17 00:00:00 2001 From: Tisha Soumya Date: Wed, 29 May 2024 10:54:55 +0530 Subject: [PATCH 04/42] Refactor TextWidget (#6020) Co-authored-by: David Glick --- packages/volto/news/6020.feature | 1 + .../components/manage/Widgets/TextWidget.jsx | 216 ++++++++---------- .../manage/Widgets/TextWidget.stories.jsx | 17 +- 3 files changed, 107 insertions(+), 127 deletions(-) create mode 100644 packages/volto/news/6020.feature diff --git a/packages/volto/news/6020.feature b/packages/volto/news/6020.feature new file mode 100644 index 0000000000..c5a57a68f3 --- /dev/null +++ b/packages/volto/news/6020.feature @@ -0,0 +1 @@ +Refactor TextWidget. @Tishasoumya-02 \ No newline at end of file diff --git a/packages/volto/src/components/manage/Widgets/TextWidget.jsx b/packages/volto/src/components/manage/Widgets/TextWidget.jsx index fe53ed89b1..37f4c0c957 100644 --- a/packages/volto/src/components/manage/Widgets/TextWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/TextWidget.jsx @@ -1,136 +1,104 @@ -/** - * TextWidget component. - * @module components/manage/Widgets/TextWidget - */ - -import React, { Component } from 'react'; +import { useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import { Input } from 'semantic-ui-react'; -import { injectIntl } from 'react-intl'; import { Icon } from '@plone/volto/components'; import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper'; -/** - * The simple text widget. - * - * It is the default fallback widget, so if no other widget is found based on - * passed field properties, it will be used. - */ -class TextWidget extends Component { - /** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ - static propTypes = { - id: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - description: PropTypes.string, - required: PropTypes.bool, - error: PropTypes.arrayOf(PropTypes.string), - value: PropTypes.string, - focus: PropTypes.bool, - onChange: PropTypes.func, - onBlur: PropTypes.func, - onClick: PropTypes.func, - onEdit: PropTypes.func, - onDelete: PropTypes.func, - icon: PropTypes.shape({ - xmlns: PropTypes.string, - viewBox: PropTypes.string, - content: PropTypes.string, - }), - iconAction: PropTypes.func, - minLength: PropTypes.number, - maxLength: PropTypes.number, - wrapped: PropTypes.bool, - placeholder: PropTypes.string, - }; +const TextWidget = (props) => { + const { + id, + value, + onChange, + onBlur, + onClick, + icon, + iconAction, + minLength, + maxLength, + placeholder, + isDisabled, + focus, + } = props; - /** - * Default properties. - * @property {Object} defaultProps Default properties. - * @static - */ - static defaultProps = { - description: null, - required: false, - error: [], - value: null, - onChange: () => {}, - onBlur: () => {}, - onClick: () => {}, - onEdit: null, - onDelete: null, - focus: false, - icon: null, - iconAction: null, - minLength: null, - maxLength: null, - }; + const ref = useRef(); - /** - * Component did mount lifecycle method - * @method componentDidMount - * @returns {undefined} - */ - componentDidMount() { - if (this.props.focus) { - this.node.focus(); + useEffect(() => { + if (focus) { + ref.current.focus(); } - } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( + + + onChange(id, target.value === '' ? undefined : target.value) + } + ref={ref} + onBlur={({ target }) => + onBlur(id, target.value === '' ? undefined : target.value) + } + onClick={() => onClick()} + minLength={minLength || null} + maxLength={maxLength || null} + /> + {icon && iconAction && ( + + )} + + ); +}; - /** - * Render method. - * @method render - * @returns {string} Markup for the component. - */ - render() { - const { - id, - value, - onChange, - onBlur, - onClick, - icon, - iconAction, - minLength, - maxLength, - placeholder, - isDisabled, - } = this.props; +export default TextWidget; - return ( - - - onChange(id, target.value === '' ? undefined : target.value) - } - ref={(node) => { - this.node = node; - }} - onBlur={({ target }) => - onBlur(id, target.value === '' ? undefined : target.value) - } - onClick={() => onClick()} - minLength={minLength || null} - maxLength={maxLength || null} - /> - {icon && iconAction && ( - - )} - - ); - } -} +TextWidget.propTypes = { + id: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + description: PropTypes.string, + required: PropTypes.bool, + error: PropTypes.arrayOf(PropTypes.string), + value: PropTypes.string, + focus: PropTypes.bool, + onChange: PropTypes.func, + onBlur: PropTypes.func, + onClick: PropTypes.func, + onEdit: PropTypes.func, + onDelete: PropTypes.func, + icon: PropTypes.shape({ + xmlns: PropTypes.string, + viewBox: PropTypes.string, + content: PropTypes.string, + }), + iconAction: PropTypes.func, + minLength: PropTypes.number, + maxLength: PropTypes.number, + wrapped: PropTypes.bool, + placeholder: PropTypes.string, +}; -export default injectIntl(TextWidget); +TextWidget.defaultProps = { + description: null, + required: false, + error: [], + value: null, + onChange: () => {}, + onBlur: () => {}, + onClick: () => {}, + onEdit: null, + onDelete: null, + focus: false, + icon: null, + iconAction: null, + minLength: null, + maxLength: null, +}; diff --git a/packages/volto/src/components/manage/Widgets/TextWidget.stories.jsx b/packages/volto/src/components/manage/Widgets/TextWidget.stories.jsx index 173228c952..885d1fa1e6 100644 --- a/packages/volto/src/components/manage/Widgets/TextWidget.stories.jsx +++ b/packages/volto/src/components/manage/Widgets/TextWidget.stories.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import TextWidget from './TextWidget'; import WidgetStory from './story'; @@ -6,7 +5,10 @@ export const Text = WidgetStory.bind({ props: { id: 'text', title: 'Text' }, widget: TextWidget, }); - +Text.args = { + description: 'description', + placeholder: 'placeholder', +}; export default { title: 'Edit Widgets/Text', component: TextWidget, @@ -17,5 +19,14 @@ export default { ), ], - argTypes: {}, + argTypes: { + description: { + control: 'text', + description: 'description', + }, + placeholder: { + control: 'text', + description: 'placeholder', + }, + }, }; From 1018359f9e44ee593e550ae12dd608f7ee9eca81 Mon Sep 17 00:00:00 2001 From: Rob Gietema Date: Thu, 30 May 2024 11:55:25 +0200 Subject: [PATCH 05/42] Object browser icon view v2 (#6054) --- .../cypress/tests/core/basic/objectBrowser.js | 5 +- .../volto/locales/ca/LC_MESSAGES/volto.po | 12 + .../volto/locales/de/LC_MESSAGES/volto.po | 12 + .../volto/locales/en/LC_MESSAGES/volto.po | 12 + .../volto/locales/es/LC_MESSAGES/volto.po | 12 + .../volto/locales/eu/LC_MESSAGES/volto.po | 12 + .../volto/locales/fi/LC_MESSAGES/volto.po | 12 + .../volto/locales/fr/LC_MESSAGES/volto.po | 12 + .../volto/locales/hi/LC_MESSAGES/volto.po | 12 + .../volto/locales/it/LC_MESSAGES/volto.po | 12 + .../volto/locales/ja/LC_MESSAGES/volto.po | 12 + .../volto/locales/nl/LC_MESSAGES/volto.po | 12 + .../volto/locales/pt/LC_MESSAGES/volto.po | 12 + .../volto/locales/pt_BR/LC_MESSAGES/volto.po | 12 + .../volto/locales/ro/LC_MESSAGES/volto.po | 12 + packages/volto/locales/volto.pot | 14 +- .../volto/locales/zh_CN/LC_MESSAGES/volto.po | 12 + packages/volto/news/5279.feature | 1 + .../manage/Sidebar/ObjectBrowserBody.jsx | 223 +++++++++++++----- .../manage/Sidebar/ObjectBrowserNav.jsx | 196 +++++++++------ .../extras/objectbrowser-widget.less | 83 +++++++ 21 files changed, 564 insertions(+), 138 deletions(-) create mode 100644 packages/volto/news/5279.feature diff --git a/packages/volto/cypress/tests/core/basic/objectBrowser.js b/packages/volto/cypress/tests/core/basic/objectBrowser.js index 293e5303d4..d439725474 100644 --- a/packages/volto/cypress/tests/core/basic/objectBrowser.js +++ b/packages/volto/cypress/tests/core/basic/objectBrowser.js @@ -97,7 +97,10 @@ describe('Object Browser Tests', () => { // The document is not in the list cy.findByLabelText('Browse My Searchable Page').should('not.exist'); // And the list has only 1 item - cy.get('.ui.segment.object-listing li').should('have.length', 1); + cy.get('.ui.segment.object-listing .image-wrapper').should( + 'have.length', + 1, + ); // The image can be selected as usual cy.findByLabelText('Select My Searchable Image').dblclick(); diff --git a/packages/volto/locales/ca/LC_MESSAGES/volto.po b/packages/volto/locales/ca/LC_MESSAGES/volto.po index c49f46036f..c5d1440d68 100644 --- a/packages/volto/locales/ca/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ca/LC_MESSAGES/volto.po @@ -1671,6 +1671,7 @@ msgstr "Historial de {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1681,6 +1682,11 @@ msgstr "Inici" msgid "ID" msgstr "Id" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2005,6 +2011,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3058,6 +3069,7 @@ msgstr "Cerca l'etiqueta d'entrada" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Resultats de la cerca" diff --git a/packages/volto/locales/de/LC_MESSAGES/volto.po b/packages/volto/locales/de/LC_MESSAGES/volto.po index f42b1f850c..05460062ad 100644 --- a/packages/volto/locales/de/LC_MESSAGES/volto.po +++ b/packages/volto/locales/de/LC_MESSAGES/volto.po @@ -1670,6 +1670,7 @@ msgstr "Historie von {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1680,6 +1681,11 @@ msgstr "Startseite" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2004,6 +2010,11 @@ msgstr "Inhalte, die im Text auf diesen Inhalt verlinken" msgid "Links and references" msgstr "Links und Referenzen" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3057,6 +3068,7 @@ msgstr "Label Suchfeld" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Suchergebnisse" diff --git a/packages/volto/locales/en/LC_MESSAGES/volto.po b/packages/volto/locales/en/LC_MESSAGES/volto.po index 351091e13d..99ff970059 100644 --- a/packages/volto/locales/en/LC_MESSAGES/volto.po +++ b/packages/volto/locales/en/LC_MESSAGES/volto.po @@ -1665,6 +1665,7 @@ msgstr "" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1675,6 +1676,11 @@ msgstr "" msgid "ID" msgstr "" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -1999,6 +2005,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3052,6 +3063,7 @@ msgstr "" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "" diff --git a/packages/volto/locales/es/LC_MESSAGES/volto.po b/packages/volto/locales/es/LC_MESSAGES/volto.po index 9ea8879da5..323c212b87 100644 --- a/packages/volto/locales/es/LC_MESSAGES/volto.po +++ b/packages/volto/locales/es/LC_MESSAGES/volto.po @@ -1672,6 +1672,7 @@ msgstr "Historial de {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1682,6 +1683,11 @@ msgstr "Inicio" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2006,6 +2012,11 @@ msgstr "Vincular este elemento con un hipervínculo en el texto" msgid "Links and references" msgstr "Enlaces y referencias" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3059,6 +3070,7 @@ msgstr "Etiqueta del campo de búsqueda" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Resultado de la búsqueda" diff --git a/packages/volto/locales/eu/LC_MESSAGES/volto.po b/packages/volto/locales/eu/LC_MESSAGES/volto.po index 2909158221..49936fe350 100644 --- a/packages/volto/locales/eu/LC_MESSAGES/volto.po +++ b/packages/volto/locales/eu/LC_MESSAGES/volto.po @@ -1672,6 +1672,7 @@ msgstr "{title} elementuaren historia" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1682,6 +1683,11 @@ msgstr "Hasiera" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2006,6 +2012,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3059,6 +3070,7 @@ msgstr "Bilaketa kutxaren etiketa" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Bilaketaren emaitzak" diff --git a/packages/volto/locales/fi/LC_MESSAGES/volto.po b/packages/volto/locales/fi/LC_MESSAGES/volto.po index 9e38934475..ea67919876 100644 --- a/packages/volto/locales/fi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fi/LC_MESSAGES/volto.po @@ -1670,6 +1670,7 @@ msgstr "{title} – muutoshistoria" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1680,6 +1681,11 @@ msgstr "Etusivu" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2004,6 +2010,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3057,6 +3068,7 @@ msgstr "Hakukentän nimike" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Hakutulokset" diff --git a/packages/volto/locales/fr/LC_MESSAGES/volto.po b/packages/volto/locales/fr/LC_MESSAGES/volto.po index f7c4e31855..422561a85a 100644 --- a/packages/volto/locales/fr/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fr/LC_MESSAGES/volto.po @@ -1672,6 +1672,7 @@ msgstr "Historique de {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1682,6 +1683,11 @@ msgstr "Accueil" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2006,6 +2012,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3059,6 +3070,7 @@ msgstr "Label du champ de recherche" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Résultats de recherche" diff --git a/packages/volto/locales/hi/LC_MESSAGES/volto.po b/packages/volto/locales/hi/LC_MESSAGES/volto.po index a91a740813..aa80505383 100644 --- a/packages/volto/locales/hi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/hi/LC_MESSAGES/volto.po @@ -1665,6 +1665,7 @@ msgstr "{title} का इतिहास" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1675,6 +1676,11 @@ msgstr "होम" msgid "ID" msgstr "आईडी" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -1999,6 +2005,11 @@ msgstr "इस आइटम के मूलपाठ में हाइपर msgid "Links and references" msgstr "लिंक और संदर्भ" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3052,6 +3063,7 @@ msgstr "खोज इनपुट लेबल" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "खोज परिणाम" diff --git a/packages/volto/locales/it/LC_MESSAGES/volto.po b/packages/volto/locales/it/LC_MESSAGES/volto.po index 8e5222dc91..856f036ffe 100644 --- a/packages/volto/locales/it/LC_MESSAGES/volto.po +++ b/packages/volto/locales/it/LC_MESSAGES/volto.po @@ -1665,6 +1665,7 @@ msgstr "Cronologia di {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1675,6 +1676,11 @@ msgstr "Home" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -1999,6 +2005,11 @@ msgstr "Elementi collegati a questo contenuto con un collegamento ipertestuali n msgid "Links and references" msgstr "Link e collegamenti" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3052,6 +3063,7 @@ msgstr "Etichetta del campo di ricerca" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Risultati della ricerca" diff --git a/packages/volto/locales/ja/LC_MESSAGES/volto.po b/packages/volto/locales/ja/LC_MESSAGES/volto.po index 5ccc2ae8c0..2a2da939ab 100644 --- a/packages/volto/locales/ja/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ja/LC_MESSAGES/volto.po @@ -1670,6 +1670,7 @@ msgstr "{title} の履歴" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1680,6 +1681,11 @@ msgstr "ホーム" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2004,6 +2010,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3057,6 +3068,7 @@ msgstr "" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "検索" diff --git a/packages/volto/locales/nl/LC_MESSAGES/volto.po b/packages/volto/locales/nl/LC_MESSAGES/volto.po index 9cb6168525..01dc20ba85 100644 --- a/packages/volto/locales/nl/LC_MESSAGES/volto.po +++ b/packages/volto/locales/nl/LC_MESSAGES/volto.po @@ -1669,6 +1669,7 @@ msgstr "Geschiedenis van {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1679,6 +1680,11 @@ msgstr "Home" msgid "ID" msgstr "" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2003,6 +2009,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3056,6 +3067,7 @@ msgstr "" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "" diff --git a/packages/volto/locales/pt/LC_MESSAGES/volto.po b/packages/volto/locales/pt/LC_MESSAGES/volto.po index fa63f79e92..7d02e71e72 100644 --- a/packages/volto/locales/pt/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt/LC_MESSAGES/volto.po @@ -1670,6 +1670,7 @@ msgstr "Histórico de {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1680,6 +1681,11 @@ msgstr "Início" msgid "ID" msgstr "" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2004,6 +2010,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3057,6 +3068,7 @@ msgstr "" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Resultados da pesquisa" diff --git a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po index a8e7d81cb0..f2ea3de844 100644 --- a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po @@ -1671,6 +1671,7 @@ msgstr "Histórico de {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1681,6 +1682,11 @@ msgstr "Início" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2005,6 +2011,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3058,6 +3069,7 @@ msgstr "Rótulo da caixa de busca" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Resultados da pesquisa" diff --git a/packages/volto/locales/ro/LC_MESSAGES/volto.po b/packages/volto/locales/ro/LC_MESSAGES/volto.po index 2ababcbc53..9481755aa6 100644 --- a/packages/volto/locales/ro/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ro/LC_MESSAGES/volto.po @@ -1665,6 +1665,7 @@ msgstr "Istoricul {title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1675,6 +1676,11 @@ msgstr "Acasă" msgid "ID" msgstr "ID" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -1999,6 +2005,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3052,6 +3063,7 @@ msgstr "Căutați eticheta de intrare" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "Rezultatele căutării" diff --git a/packages/volto/locales/volto.pot b/packages/volto/locales/volto.pot index 82a00408e7..c28b4ea5dc 100644 --- a/packages/volto/locales/volto.pot +++ b/packages/volto/locales/volto.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2024-05-03T06:54:04.407Z\n" +"POT-Creation-Date: 2024-05-29T18:53:42.120Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "Content-Type: text/plain; charset=utf-8\n" @@ -1667,6 +1667,7 @@ msgstr "" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1677,6 +1678,11 @@ msgstr "" msgid "ID" msgstr "" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2001,6 +2007,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3054,6 +3065,7 @@ msgstr "" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "" diff --git a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po index 2f53f62d3e..d4511f9c05 100644 --- a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po +++ b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po @@ -1671,6 +1671,7 @@ msgstr "历史{title}" #: components/manage/Contents/Contents #: components/manage/Contents/ContentsBreadcrumbs #: components/manage/Contents/ContentsBreadcrumbsHomeItem +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Breadcrumbs/Breadcrumbs #: components/theme/Logo/Logo msgid "Home" @@ -1681,6 +1682,11 @@ msgstr "首页" msgid "ID" msgstr "" +#. Default: "Icon View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "Icon View" +msgstr "" + #. Default: "If all of the following conditions are met:" #: components/manage/Controlpanels/Rules/ConfigureRule msgid "If all of the following conditions are met:" @@ -2005,6 +2011,11 @@ msgstr "" msgid "Links and references" msgstr "" +#. Default: "List View" +#: components/manage/Sidebar/ObjectBrowserBody +msgid "List View" +msgstr "" + #. Default: "Listing" #: components/manage/Blocks/Listing/schema msgid "Listing" @@ -3058,6 +3069,7 @@ msgstr "搜索输入标签" #. Default: "Search results" #: components/manage/Blocks/Search/components/SearchDetails +#: components/manage/Sidebar/ObjectBrowserBody #: components/theme/Search/Search msgid "Search results" msgstr "搜索结果" diff --git a/packages/volto/news/5279.feature b/packages/volto/news/5279.feature new file mode 100644 index 0000000000..a93c6febfb --- /dev/null +++ b/packages/volto/news/5279.feature @@ -0,0 +1 @@ +Added object browser icon view @robgietema \ No newline at end of file diff --git a/packages/volto/src/components/manage/Sidebar/ObjectBrowserBody.jsx b/packages/volto/src/components/manage/Sidebar/ObjectBrowserBody.jsx index 194f32b2a5..7ce0d3d455 100644 --- a/packages/volto/src/components/manage/Sidebar/ObjectBrowserBody.jsx +++ b/packages/volto/src/components/manage/Sidebar/ObjectBrowserBody.jsx @@ -21,6 +21,8 @@ import clearSVG from '@plone/volto/icons/clear.svg'; import searchSVG from '@plone/volto/icons/zoom.svg'; import linkSVG from '@plone/volto/icons/link.svg'; import homeSVG from '@plone/volto/icons/home.svg'; +import iconsSVG from '@plone/volto/icons/apps.svg'; +import listSVG from '@plone/volto/icons/list-bullet.svg'; import ObjectBrowserNav from '@plone/volto/components/manage/Sidebar/ObjectBrowserNav'; @@ -41,6 +43,18 @@ const messages = defineMessages({ id: 'Search SVG', defaultMessage: 'Search SVG', }, + iconView: { + id: 'Icon View', + defaultMessage: 'Icon View', + }, + listView: { + id: 'List View', + defaultMessage: 'List View', + }, + home: { + id: 'Home', + defaultMessage: 'Home', + }, of: { id: 'Selected items - x of y', defaultMessage: 'of' }, }); @@ -132,6 +146,7 @@ class ObjectBrowserBody extends Component { this.props.mode === 'image' ? this.props.searchableTypes || config.settings.imageObjects : this.props.searchableTypes, + view: this.props.mode === 'image' ? 'icons' : 'list', }; this.searchInputRef = React.createRef(); } @@ -201,10 +216,28 @@ class ObjectBrowserBody extends Component { showSearchInput: !prevState.showSearchInput, }), () => { - if (this.searchInputRef?.current) this.searchInputRef.current.focus(); + if (this.searchInputRef?.current) { + this.searchInputRef.current.focus(); + } else { + this.props.searchContent( + this.state.currentFolder, + { + 'path.depth': 1, + sort_on: 'getObjPositionInParent', + metadata_fields: '_all', + b_size: 1000, + }, + `${this.props.block}-${this.props.mode}`, + ); + } }, ); + toggleView = () => + this.setState((prevState) => ({ + view: prevState.view === 'icons' ? 'list' : 'icons', + })); + onSearch = (e) => { const text = flattenToAppURL(e.target.value); if (text.startsWith('/')) { @@ -386,25 +419,9 @@ class ObjectBrowserBody extends Component { */ render() { return ( - +
- {this.state.currentFolder === '/' ? ( - <> - {this.props.mode === 'image' ? ( - - ) : ( - - )} - - ) : ( - - )} {this.state.showSearchInput ? ( - ) : this.props.mode === 'image' ? ( -

- -

) : ( -

- -

+ <> + {this.state.currentFolder === '/' ? ( + <> + {this.props.mode === 'image' ? ( + + ) : ( + + )} + + ) : ( + + )} + {this.props.mode === 'image' ? ( +

+ +

+ ) : ( +

+ +

+ )} + )}
- - {this.state.currentFolder !== '/' ? ( - this.state.currentFolder.split('/').map((item, index, items) => { - return ( - - {index === 0 ? ( - this.navigateTo('/')}> - - - ) : ( - <> - - - this.navigateTo(items.slice(0, index + 1).join('/')) - } - > - {item} - - - )} - - ); - }) - ) : ( - this.navigateTo('/')}> - - - )} - + {this.props.mode === 'image' && ( + + )} + {!this.state.showSearchInput ? ( + + {this.state.currentFolder !== '/' ? ( + this.state.currentFolder + .split('/') + .map((item, index, items) => { + return ( + + {index === 0 ? ( + this.navigateTo('/')} + role="button" + aria-label={this.props.intl.formatMessage( + messages.home, + )} + > + + + ) : ( + <> + + + this.navigateTo( + items.slice(0, index + 1).join('/'), + ) + } + > + {item} + + + )} + + ); + }) + ) : ( + this.navigateTo('/')} + aria-label={this.props.intl.formatMessage(messages.home)} + > + + + )} + + ) : ( +
+ +
+ )}
{this.props.mode === 'multiple' && ( @@ -510,6 +601,7 @@ class ObjectBrowserBody extends Component { handleClickOnItem={this.handleClickOnItem} handleDoubleClickOnItem={this.handleDoubleClickOnItem} mode={this.props.mode} + view={this.state.view} navigateTo={this.navigateTo} isSelectable={this.isSelectable} /> @@ -523,6 +615,7 @@ export default compose( connect( (state) => ({ searchSubrequests: state.search.subrequests, + lang: state.intl.locale, }), { searchContent }, ), diff --git a/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx b/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx index 14e7d605c1..d7324ba1b3 100644 --- a/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx +++ b/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx @@ -26,6 +26,7 @@ const ObjectBrowserNav = ({ handleClickOnItem, handleDoubleClickOnItem, mode, + view, navigateTo, isSelectable, }) => { @@ -47,83 +48,136 @@ const ObjectBrowserNav = ({ return ( {currentSearchResults && - currentSearchResults.items.map((item) => ( -
  • handleClickOnItem(item)} - onDoubleClick={() => handleDoubleClickOnItem(item)} - > - - - {' '} - {flattenToAppURL(item['@id'])} ( {item['@type']}) - - } - trigger={ - - - - } - /> - - {item.title} - - {item.is_folderish && mode === 'image' && ( - - )} - {item.is_folderish && (mode === 'link' || mode === 'multiple') && ( + currentSearchResults.items.map((item) => + view === 'icons' ? ( +
  • { - e.stopPropagation(); - navigateTo(item['@id']); - }} + onClick={(e) => handleClickOnItem(item)} + onDoubleClick={() => handleDoubleClickOnItem(item)} + className="image-preview" + aria-label={`${intl.formatMessage(messages.select)} ${ + item.title + }`} > - - - +
    + )} + +
    +
    handleClickOnItem(item)} + aria-hidden="true" + > +
    + {item.title} +
    +
    - )} -
  • - ))} + + ) : ( +
  • handleClickOnItem(item)} + onDoubleClick={() => handleDoubleClickOnItem(item)} + > + + + {' '} + {flattenToAppURL(item['@id'])} ( {item['@type']}) + + } + trigger={ + + + + } + /> + + {item.title} + + {item.is_folderish && mode === 'image' && ( + + )} + {item.is_folderish && + (mode === 'link' || mode === 'multiple') && ( +
    { + e.stopPropagation(); + navigateTo(item['@id']); + }} + > + + + +
    + )} +
  • + ), + )}
    ); }; diff --git a/packages/volto/theme/themes/pastanaga/extras/objectbrowser-widget.less b/packages/volto/theme/themes/pastanaga/extras/objectbrowser-widget.less index f1217fc517..6195be6671 100644 --- a/packages/volto/theme/themes/pastanaga/extras/objectbrowser-widget.less +++ b/packages/volto/theme/themes/pastanaga/extras/objectbrowser-widget.less @@ -41,3 +41,86 @@ border: none !important; } } + +.object-browser { + .mode-switch { + margin-right: 8px; + cursor: pointer; + float: right; + } + + header h2 { + margin: 2px 0 !important; + } + + .searchResults { + margin-left: 20px; + font-size: 14px; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + line-height: 1.5; + text-rendering: optimizeLegibility; + text-size-adjust: 100%; + } + + ul.object-listing { + padding: 0; + } + + .image-wrapper { + display: block; + margin: 16px; + float: left; + + img, + .icon-wrapper { + background-color: #edf1f2; + cursor: pointer; + outline: 0; + } + + .selected { + outline: solid 3px #517776 !important; + } + + img:hover, + .icon-wrapper:hover { + outline: solid 3px rgb(187, 198, 200); + } + + .image-preview, + .image-preview:hover { + display: flex; + border: 0; + border-radius: 0; + box-shadow: none; + + img { + width: 200px; + height: 200px; + object-fit: contain; + } + } + + .image-preview, + .image-title { + cursor: pointer; + text-align: center; + } + + .image-title { + margin-top: 5px; + } + + .image-title-content { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .icon-wrapper { + display: flex; + padding: 46px; + } + } +} From b5aa2dd77f395b5156f39da33ec107f4d03276fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Thu, 30 May 2024 19:32:17 +0200 Subject: [PATCH 06/42] [components] Fix `align-items: start` to make autoprefixer happy (#6062) --- packages/components/news/6062.bugfix | 1 + packages/components/src/styles/basic/BlockToolbar.css | 2 +- packages/components/src/styles/basic/Form.css | 2 +- packages/components/src/styles/basic/Toolbar.css | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 packages/components/news/6062.bugfix diff --git a/packages/components/news/6062.bugfix b/packages/components/news/6062.bugfix new file mode 100644 index 0000000000..607d792c2b --- /dev/null +++ b/packages/components/news/6062.bugfix @@ -0,0 +1 @@ +Fix `align-items: start` to make autoprefixer happy @sneridagh diff --git a/packages/components/src/styles/basic/BlockToolbar.css b/packages/components/src/styles/basic/BlockToolbar.css index ba28e1ca7a..e29d2c04bc 100644 --- a/packages/components/src/styles/basic/BlockToolbar.css +++ b/packages/components/src/styles/basic/BlockToolbar.css @@ -38,7 +38,7 @@ &[data-orientation='vertical'] { flex-direction: column; - align-items: start; + align-items: flex-start; } } diff --git a/packages/components/src/styles/basic/Form.css b/packages/components/src/styles/basic/Form.css index 4b65ea32c3..fc425bffff 100644 --- a/packages/components/src/styles/basic/Form.css +++ b/packages/components/src/styles/basic/Form.css @@ -5,7 +5,7 @@ .react-aria-Form { display: flex; flex-direction: column; - align-items: start; + align-items: flex-start; gap: 8px; } diff --git a/packages/components/src/styles/basic/Toolbar.css b/packages/components/src/styles/basic/Toolbar.css index b193591351..2d025f561d 100644 --- a/packages/components/src/styles/basic/Toolbar.css +++ b/packages/components/src/styles/basic/Toolbar.css @@ -33,7 +33,7 @@ &[data-orientation='vertical'] { flex-direction: column; - align-items: start; + align-items: flex-start; } } From 6765579f2659377378081f8ca46d19daf614e71c Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Thu, 30 May 2024 19:49:20 +0200 Subject: [PATCH 07/42] Release @plone/components 2.0.0-alpha.10 --- packages/components/CHANGELOG.md | 6 ++++++ packages/components/news/6062.bugfix | 1 - packages/components/package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 packages/components/news/6062.bugfix diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 4e9ae47b89..8b6e851f3e 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,6 +8,12 @@ +## 2.0.0-alpha.10 (2024-05-30) + +### Bugfix + +- Fix `align-items: start` to make autoprefixer happy @sneridagh [#6062](https://github.com/plone/volto/issues/6062) + ## 2.0.0-alpha.9 (2024-05-23) ### Feature diff --git a/packages/components/news/6062.bugfix b/packages/components/news/6062.bugfix deleted file mode 100644 index 607d792c2b..0000000000 --- a/packages/components/news/6062.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix `align-items: start` to make autoprefixer happy @sneridagh diff --git a/packages/components/package.json b/packages/components/package.json index 02f539f96f..a8d0662114 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -8,7 +8,7 @@ } ], "license": "MIT", - "version": "2.0.0-alpha.9", + "version": "2.0.0-alpha.10", "repository": { "type": "git", "url": "http://github.com/plone/components.git" From 6b493b4397bbf8f2b2f120ba442a64762caea761 Mon Sep 17 00:00:00 2001 From: Steffen Lindner Date: Thu, 30 May 2024 20:56:28 +0200 Subject: [PATCH 08/42] Pass class into breadcrumbs RAC (#6018) Co-authored-by: Victor Fernandez de Alba --- packages/components/news/6018.bugfix | 1 + packages/components/src/components/Breadcrumbs/Breadcrumbs.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 packages/components/news/6018.bugfix diff --git a/packages/components/news/6018.bugfix b/packages/components/news/6018.bugfix new file mode 100644 index 0000000000..3761764bc6 --- /dev/null +++ b/packages/components/news/6018.bugfix @@ -0,0 +1 @@ +Fix ignored classname in breadcrumbs RAC @gomez diff --git a/packages/components/src/components/Breadcrumbs/Breadcrumbs.tsx b/packages/components/src/components/Breadcrumbs/Breadcrumbs.tsx index c7f8f7dbd6..957c6e0f40 100644 --- a/packages/components/src/components/Breadcrumbs/Breadcrumbs.tsx +++ b/packages/components/src/components/Breadcrumbs/Breadcrumbs.tsx @@ -27,6 +27,7 @@ interface BreadcrumbsProps extends RACBreadcrumbsProps { * Breadcrumbs display a hierarchy of links to the current page or resource in an application. */ export function Breadcrumbs({ + className, items, root, includeRoot, @@ -42,7 +43,7 @@ export function Breadcrumbs({ return (