mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-25 20:40:36 +03:00
F: Rework location picker
This commit is contained in:
parent
2013dca777
commit
30b5bd176d
|
@ -5,7 +5,7 @@ import clsx from 'clsx';
|
||||||
|
|
||||||
import { useAuthSuspense } from '@/features/auth';
|
import { useAuthSuspense } from '@/features/auth';
|
||||||
|
|
||||||
import { Label, TextArea } from '@/components/input';
|
import { TextArea } from '@/components/input';
|
||||||
import { type Styling } from '@/components/props';
|
import { type Styling } from '@/components/props';
|
||||||
|
|
||||||
import { LocationHead } from '../../models/library';
|
import { LocationHead } from '../../models/library';
|
||||||
|
@ -35,18 +35,16 @@ export function PickLocation({
|
||||||
const { user } = useAuthSuspense();
|
const { user } = useAuthSuspense();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('flex', className)} {...restProps}>
|
<div className={clsx('flex relative', className)} {...restProps}>
|
||||||
<div className='flex flex-col gap-2 min-w-28'>
|
<SelectLocationHead
|
||||||
<Label className='select-none' text='Корень' />
|
className='absolute right-0 top-0'
|
||||||
<SelectLocationHead
|
value={value.substring(0, 2) as LocationHead}
|
||||||
value={value.substring(0, 2) as LocationHead}
|
onChange={newValue => onChange(combineLocation(newValue, value.substring(3)))}
|
||||||
onChange={newValue => onChange(combineLocation(newValue, value.substring(3)))}
|
excluded={!user.is_staff ? [LocationHead.LIBRARY] : []}
|
||||||
excluded={!user.is_staff ? [LocationHead.LIBRARY] : []}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<SelectLocationContext
|
<SelectLocationContext
|
||||||
className='-mt-1 -ml-8'
|
className='absolute left-28 -top-1'
|
||||||
dropdownHeight={dropdownHeight} //
|
dropdownHeight={dropdownHeight} //
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
@ -54,7 +52,7 @@ export function PickLocation({
|
||||||
|
|
||||||
<TextArea
|
<TextArea
|
||||||
id='dlg_location'
|
id='dlg_location'
|
||||||
label='Путь'
|
label='Расположение'
|
||||||
rows={rows}
|
rows={rows}
|
||||||
value={value.substring(3)}
|
value={value.substring(3)}
|
||||||
onChange={event => onChange(combineLocation(value.substring(0, 2), event.target.value))}
|
onChange={event => onChange(combineLocation(value.substring(0, 2), event.target.value))}
|
||||||
|
|
|
@ -38,13 +38,13 @@ export function SelectLocationContext({
|
||||||
<div
|
<div
|
||||||
ref={menu.ref} //
|
ref={menu.ref} //
|
||||||
onBlur={menu.handleBlur}
|
onBlur={menu.handleBlur}
|
||||||
className={clsx('relative text-right self-start', className)}
|
className={clsx('text-right self-start', className)}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
>
|
>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
title={title}
|
title={title}
|
||||||
hideTitle={menu.isOpen}
|
hideTitle={menu.isOpen}
|
||||||
icon={<IconFolderTree size='1.25rem' className='icon-green' />}
|
icon={<IconFolderTree size='1.25rem' className='icon-primary' />}
|
||||||
onClick={() => menu.toggle()}
|
onClick={() => menu.toggle()}
|
||||||
/>
|
/>
|
||||||
<Dropdown isOpen={menu.isOpen} className={clsx('w-80 z-tooltip', dropdownHeight)}>
|
<Dropdown isOpen={menu.isOpen} className={clsx('w-80 z-tooltip', dropdownHeight)}>
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function SelectLocationHead({
|
||||||
onClick={menu.toggle}
|
onClick={menu.toggle}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Dropdown isOpen={menu.isOpen} margin='mt-2'>
|
<Dropdown isOpen={menu.isOpen} stretchLeft margin='mt-2'>
|
||||||
{Object.values(LocationHead)
|
{Object.values(LocationHead)
|
||||||
.filter(head => !excluded.includes(head))
|
.filter(head => !excluded.includes(head))
|
||||||
.map((head, index) => {
|
.map((head, index) => {
|
||||||
|
|
|
@ -171,13 +171,13 @@ export function ToolbarSearch({ className, total, filtered }: ToolbarSearchProps
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
text='проводник...'
|
text='проводник...'
|
||||||
title='Переключение в режим Проводник'
|
title='Переключение в режим Проводник'
|
||||||
icon={<IconFolderTree size='1rem' className='cc-controls' />}
|
icon={<IconFolderTree size='1rem' className='icon-primary' />}
|
||||||
onClick={handleToggleFolder}
|
onClick={handleToggleFolder}
|
||||||
/>
|
/>
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
text='отображать все'
|
text='отображать все'
|
||||||
title='Очистить фильтр по расположению'
|
title='Очистить фильтр по расположению'
|
||||||
icon={<IconFolder size='1rem' className='cc-controls' />}
|
icon={<IconFolder size='1rem' className='icon-primary' />}
|
||||||
onClick={() => handleChange(null)}
|
onClick={() => handleChange(null)}
|
||||||
/>
|
/>
|
||||||
{Object.values(LocationHead).map((head, index) => {
|
{Object.values(LocationHead).map((head, index) => {
|
||||||
|
|
|
@ -42,7 +42,7 @@ export function useLibraryColumns() {
|
||||||
noHover
|
noHover
|
||||||
className='pl-2 max-h-4 -translate-y-0.5'
|
className='pl-2 max-h-4 -translate-y-0.5'
|
||||||
onClick={handleToggleFolder}
|
onClick={handleToggleFolder}
|
||||||
icon={<IconFolderTree size='1.25rem' className='text-muted-foreground hover:text-constructive' />}
|
icon={<IconFolderTree size='1.25rem' className='text-muted-foreground hover:text-primary' />}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
size: 50,
|
size: 50,
|
||||||
|
|
|
@ -88,7 +88,7 @@ export function ViewSideLocation({ isVisible, onRenameLocation }: ViewSideLocati
|
||||||
<MiniButton
|
<MiniButton
|
||||||
noHover
|
noHover
|
||||||
title='Переключение в режим Таблица'
|
title='Переключение в режим Таблица'
|
||||||
icon={<IconFolderTree size='1.25rem' className='text-muted-foreground hover:text-constructive' />}
|
icon={<IconFolderTree size='1.25rem' className='text-muted-foreground hover:text-primary' />}
|
||||||
onClick={toggleFolderMode}
|
onClick={toggleFolderMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user