Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 15 additions & 9 deletions assets/js/src/core/modules/search/modal/search-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,22 @@ export const SearchModal = (): React.JSX.Element => {
onCancel={ () => { close() } }
open={ isOpen }
size={ 'XL' }
title={ t('search-modal.title') }
>
<Tabs
activeKey={ activeKey }
data-testid="search-modal-tabs"
items={ tabItems }
noTabBarMargin
onChange={ (key) => {
setActiveKey(key)
} }
/>
<div style={ { display: 'flex', flexDirection: 'column', height: 500 } }>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discuss this with @vin0401 to be sure. Should we e.g. use our Flex component?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, would vote for our flex here.

<Tabs
activeKey={ activeKey }
data-testid="search-modal-tabs"
fullHeight
items={ tabItems }
noPadding
noTabBarMargin
onChange={ (key) => {
setActiveKey(key)
} }
style={ { flex: 1, minHeight: 0 } }
/>
</div>
</Modal>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Flex } from '@Pimcore/components/flex/flex'
export const Toolbar = (): React.JSX.Element => {
return (
<BaseToolbar
borderStyle='default'
padding={ { right: 'none', left: 'none' } }
theme='secondary'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ import React from 'react'
export const TopBar = (): React.JSX.Element => {
return (
<Toolbar
borderStyle='default'
padding={ { left: 'none', right: 'none' } }
position='top'
position='none'
theme='secondary'
>
<Flex
className='w-full'
gap={ 'small' }
gap={ 'extra-small' }
>
<ProvidedTypeSelect />
<SearchTermFilter />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Flex } from '@Pimcore/components/flex/flex'
export const Toolbar = (): React.JSX.Element => {
return (
<BaseToolbar
borderStyle='default'
padding={ { right: 'none', left: 'none' } }
theme='secondary'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ import React from 'react'
export const TopBar = (): React.JSX.Element => {
return (
<Toolbar
borderStyle='default'
padding={ { left: 'none', right: 'none' } }
position='top'
position='none'
theme='secondary'
>
<Flex
className='w-full'
gap={ 'small' }
gap={ 'extra-small' }
>
<ProvidedTypeSelect />
<SearchTermFilter />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,18 @@ export const SearchResult = (): React.JSX.Element => {
}

return (
<>
<div />

<SplitLayout
leftItem={
<div style={ { display: 'flex', flexDirection: 'column', height: '100%' } }>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discuss this with @vin0401 to be sure. Should we e.g. use our Flex component?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, would vote for our flex here.

<div style={ { flex: 1, overflow: 'hidden', minHeight: 0 } }>
<SplitLayout
leftItem={
{
size: 750,
children: (
<Content
overflow={ { x: 'hidden', y: 'auto' } }
padded
padding={ { left: 'none', right: 'none', y: 'none' } }
style={ { height: 400 } }
style={ { height: '100%' } }
>
<Flex
className='w-full h-full'
Expand Down Expand Up @@ -116,7 +115,7 @@ export const SearchResult = (): React.JSX.Element => {
}
}

rightItem={
rightItem={
{
size: 250,
minSize: 250,
Expand All @@ -127,10 +126,14 @@ export const SearchResult = (): React.JSX.Element => {
}
}

withDivider
/>
withDivider
/>
</div>

<Toolbar theme='secondary'>
<Toolbar
padding={ { left: 'none', right: 'none' } }
theme='secondary'
>
<Pagination
onChange={ onChange }
pageSizeOptions={ [10, 20, 50, 100] }
Expand All @@ -139,7 +142,7 @@ export const SearchResult = (): React.JSX.Element => {
total={ data?.totalItems ?? 0 }
/>
</Toolbar>
</>
</div>
)
}, [data, selectedItem, isLoading])
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { LanguageSelectionWithProvider } from '@Pimcore/components/language-sele
export const Toolbar = (): React.JSX.Element => {
return (
<BaseToolbar
borderStyle='default'
padding={ { right: 'none', left: 'none' } }
theme='secondary'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ import { Toolbar } from '@Pimcore/components/toolbar/toolbar'
import { ClassDefinitionSelect } from '@Pimcore/modules/data-object/listing/decorator/class-definition-selection/components/class-definition-select/class-definition-select'
import { ProvidedTypeSelect } from '@Pimcore/modules/element/components/type-select/provided-type-select'
import { SearchTermFilter } from '@Pimcore/modules/element/listing/decorators/general-filters/view-layer/components/search/search-term-filter'
import { Flex } from 'antd'
import { Flex } from '@Pimcore/components/flex/flex'
import React from 'react'

export const TopBar = (): React.JSX.Element => {
return (
<Toolbar
borderStyle='default'
padding={ { left: 'none', right: 'none' } }
position='top'
position='none'
theme='secondary'
>
<Flex
className='w-full'
gap={ 'small' }
gap={ 'extra-small' }
>
<ProvidedTypeSelect />
<ClassDefinitionSelect nullable />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import { createStyles } from '@Pimcore/modules/ant-design/styles/create-styles'

export const useStyles = createStyles(({ css, token }) => {
return {
// Purple line under the search bar, mirroring the paging toolbar's top border.
topBar: css`
border-bottom: 1px solid ${token.colorPrimaryBorder};
border-bottom: 1px solid ${token.colorBorderTertiary};
`
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ export const SavedSearchesTab = (): React.JSX.Element => {
.finally(() => { setDeletingId(undefined) })
}

const tableItems: SavedSearchRow[] = (data?.items ?? []).map((item) => ({
...item,
ownership: item.owner ? t('saved-search.ownership.own') : t('saved-search.ownership.shared'),
modificationDateLabel: formatDateTime({ timestamp: item.modificationDate, dateStyle: 'short', timeStyle: 'short' })
}))
const tableItems: SavedSearchRow[] = [
...(data?.items ?? []).map((item) => ({
...item,
ownership: item.owner ? t('saved-search.ownership.own') : t('saved-search.ownership.shared'),
modificationDateLabel: formatDateTime({ timestamp: item.modificationDate, dateStyle: 'short', timeStyle: 'short' })
}))
]

const columnHelper = createColumnHelper<SavedSearchRow>()
const columns = [
Expand Down Expand Up @@ -137,7 +139,7 @@ export const SavedSearchesTab = (): React.JSX.Element => {
<Flex align='center'>
<IconButton
data-testid='saved-search-open-button'
icon={ { value: 'folder' } }
icon={ { value: 'open-folder' } }
loading={ openingId === row.original.id }
onClick={ () => { onOpen(row.original.id) } }
tooltip={ { title: t('saved-search.open') } }
Expand Down Expand Up @@ -167,24 +169,27 @@ export const SavedSearchesTab = (): React.JSX.Element => {
]

return (
<ContentLayout
renderToolbar={
<Toolbar
borderStyle='primary'
margin={ { top: 'small' } }
padding={ { x: 'small', y: 'extra-small' } }
theme='secondary'
>
<Flex align='center'>
<IconButton
data-testid='saved-search-refresh-button'
disabled={ isFetching }
icon={ { value: 'refresh' } }
onClick={ () => { void refetch() } }
tooltip={ { title: t('refresh') } }
type='link'
/>
{total > 0 && (
<div style={ { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 } }>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discuss this with @vin0401. position: absolute looks strange?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be the hack to get something stretch over the while content, any isides here @idaiv?
But I think for tabs we also already should have a build in solution.

<ContentLayout
renderToolbar={
<Toolbar
padding={ { left: 'none', right: 'none' } }
position={ total > 0 ? 'none' : 'bottom' }
theme='secondary'
>
<Flex
align='center'
gap='extra-small'
>
<IconButton
data-testid='saved-search-refresh-button'
disabled={ isFetching }
icon={ { value: 'refresh' } }
onClick={ () => { void refetch() } }
tooltip={ { title: t('refresh') } }
type='link'
/>
{total > 0 && (
<>
<Divider
size='small'
Expand All @@ -202,52 +207,53 @@ export const SavedSearchesTab = (): React.JSX.Element => {
total={ total }
/>
</>
)}
</Flex>
</Toolbar>
)}
</Flex>
</Toolbar>
}
renderTopBar={
<Box
className={ styles.topBar }
margin={ { bottom: 'small' } }
padding={ { x: 'small', y: 'extra-small' } }
>
<SearchInput
maxWidth='100%'
onSearch={ (value) => {
setCurrentPage(1)
setSearchTerm(value)
} }
placeholder={ t('component.search.pleaceholder') }
/>
</Box>
renderTopBar={
<Box
className={ (data?.totalItems ?? 0) === 0 ? styles.topBar : undefined }
margin={ { bottom: 'small' } }
padding={ { y: 'extra-small' } }
>
<SearchInput
maxWidth='100%'
onSearch={ (value) => {
setCurrentPage(1)
setSearchTerm(value)
} }
placeholder={ t('component.search.pleaceholder') }
/>
</Box>
}
>
<Content
margin={ { x: 'extra-small', y: 'none' } }
none={ !isFetching && isEmpty(data?.items) }
>
<Box margin={ { x: 'extra-small', y: 'none' } }>
<Grid
autoWidth
columns={ columns }
data={ tableItems }
enableSorting
isLoading={ isFetching }
manualSorting
onSortingChange={ (nextSorting) => {
setSorting(nextSorting)
setCurrentPage(1)
} }
resizable
<Content
margin={ { x: 'extra-small', y: 'none' } }
none={ !isFetching && isEmpty(data?.items) }
>
<Box margin={ { x: 'extra-small', y: 'none' } }>
<Grid
autoWidth
columns={ columns }
data={ tableItems }
enableSorting
isLoading={ isFetching }
manualSorting
onSortingChange={ (nextSorting) => {
setSorting(nextSorting)
setCurrentPage(1)
} }
resizable
// During loading the Grid renders placeholder rows without an id; return undefined for
// those so it falls back to unique index ids (a constant id collides → phantom skeleton
// rows linger after the data loads).
setRowId={ (row) => isUndefined(row.id) ? (undefined as unknown as string) : String(row.id) }
sorting={ sorting }
/>
</Box>
</Content>
</ContentLayout>
setRowId={ (row) => isUndefined(row.id) ? (undefined as unknown as string) : String(row.id) }
sorting={ sorting }
/>
</Box>
</Content>
</ContentLayout>
</div>
)
}
Binary file not shown.
2 changes: 2 additions & 0 deletions translations/studio.de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,8 @@ image-gallery.clear-image-selection: Bildauswahl leeren
image-gallery.delete-frame: Rahmen löschen
text: Text
video: Video
object: Objekt
variant: Variante
processing: Verarbeitung
upload: Hochladen
close: Schließen
Expand Down
5 changes: 4 additions & 1 deletion translations/studio.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,8 @@ image-gallery.clear-image-selection: Clear Image Selection
image-gallery.delete-frame: Delete Frame
text: Text
video: Video
object: Object
variant: Variant
processing: Processing
upload: Upload
close: Close
Expand Down Expand Up @@ -1371,6 +1373,7 @@ key-bindings.searchAsset: Search Asset
key-bindings.searchObject: Search Object
key-bindings.searchAndReplaceAssignments: Search and Replace Assignments
key-bindings.quickSearch: Quick Search
search-modal.title: Quick Search
key-bindings.system: System
key-bindings.showMetaInfo: Show Meta Info
key-bindings.showElementHistory: Show Element History
Expand Down Expand Up @@ -2815,7 +2818,7 @@ saved-search.delete-search: Delete search
saved-search.save-as-new: Save as new search
saved-search.create-menu-shortcut: Create shortcut in menu
saved-search.save.success: Saved search created
saved-search.saved-searches: Saved searches
saved-search.saved-searches: Saved Searches
saved-search.ownership: Ownership
saved-search.ownership.own: Own
saved-search.ownership.shared: Shared with me
Expand Down
2 changes: 2 additions & 0 deletions translations/studio.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,8 @@ image-gallery.clear-image-selection: Borrar selección de imagen
image-gallery.delete-frame: Eliminar marco
text: Texto
video: Vídeo
object: Objeto
variant: Variante
processing: Procesando
upload: Subir
close: Cerrar
Expand Down
Loading
Loading