mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Minor UI fixes
This commit is contained in:
parent
6988d07f04
commit
5a67d982e5
|
@ -1,4 +1,3 @@
|
||||||
import { useMemo } from 'react';
|
|
||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import Footer from './components/Footer';
|
import Footer from './components/Footer';
|
||||||
|
@ -17,21 +16,7 @@ import RSFormPage from './pages/RSFormPage';
|
||||||
import UserProfilePage from './pages/UserProfilePage';
|
import UserProfilePage from './pages/UserProfilePage';
|
||||||
|
|
||||||
function App () {
|
function App () {
|
||||||
const { noNavigation } = useConceptTheme();
|
const { noNavigation, viewportHeight, mainHeight } = useConceptTheme();
|
||||||
|
|
||||||
const scrollWindowSize = useMemo(
|
|
||||||
() => {
|
|
||||||
return !noNavigation ?
|
|
||||||
'calc(100vh - 4.5rem)'
|
|
||||||
: '100vh';
|
|
||||||
}, [noNavigation]);
|
|
||||||
const mainSize = useMemo(
|
|
||||||
() => {
|
|
||||||
return !noNavigation ?
|
|
||||||
'calc(100vh - 9.2rem)'
|
|
||||||
: '100vh';
|
|
||||||
}, [noNavigation]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='antialiased clr-app'>
|
<div className='antialiased clr-app'>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
|
@ -42,8 +27,8 @@ function App () {
|
||||||
pauseOnFocusLoss={false}
|
pauseOnFocusLoss={false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className='overflow-auto' style={{maxHeight: scrollWindowSize}}>
|
<div className='overflow-auto' style={{maxHeight: viewportHeight}}>
|
||||||
<main style={{minHeight: mainSize}}>
|
<main className='h-full' style={{minHeight: mainHeight}}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/' element={ <HomePage/>} />
|
<Route path='/' element={ <HomePage/>} />
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import { createContext, useContext, useEffect, useState } from 'react';
|
import { createContext, useContext, useLayoutEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import useLocalStorage from '../hooks/useLocalStorage';
|
import useLocalStorage from '../hooks/useLocalStorage';
|
||||||
|
|
||||||
interface IThemeContext {
|
interface IThemeContext {
|
||||||
darkMode: boolean
|
darkMode: boolean
|
||||||
noNavigation: boolean
|
noNavigation: boolean
|
||||||
|
viewportHeight: string
|
||||||
|
mainHeight: string
|
||||||
toggleDarkMode: () => void
|
toggleDarkMode: () => void
|
||||||
toggleNoNavigation: () => void
|
toggleNoNavigation: () => void
|
||||||
}
|
}
|
||||||
|
@ -38,16 +40,31 @@ export const ThemeState = ({ children }: ThemeStateProps) => {
|
||||||
root.setAttribute('data-color-scheme', !isDark ? 'light' : 'dark');
|
root.setAttribute('data-color-scheme', !isDark ? 'light' : 'dark');
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setDarkClass(darkMode)
|
setDarkClass(darkMode)
|
||||||
}, [darkMode]);
|
}, [darkMode]);
|
||||||
|
|
||||||
|
const mainHeight = useMemo(
|
||||||
|
() => {
|
||||||
|
return !noNavigation ?
|
||||||
|
'calc(100vh - 9.2rem)'
|
||||||
|
: '100vh';
|
||||||
|
}, [noNavigation]);
|
||||||
|
|
||||||
|
const viewportHeight = useMemo(
|
||||||
|
() => {
|
||||||
|
return !noNavigation ?
|
||||||
|
'calc(100vh - 4.5rem)'
|
||||||
|
: '100vh';
|
||||||
|
}, [noNavigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeContext.Provider value={{
|
<ThemeContext.Provider value={{
|
||||||
darkMode,
|
darkMode,
|
||||||
toggleDarkMode: () => setDarkMode(prev => !prev),
|
|
||||||
noNavigation,
|
noNavigation,
|
||||||
toggleNoNavigation: () => setNoNavigation(prev => !prev)
|
toggleDarkMode: () => setDarkMode(prev => !prev),
|
||||||
|
toggleNoNavigation: () => setNoNavigation(prev => !prev),
|
||||||
|
viewportHeight, mainHeight
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
</ThemeContext.Provider>
|
</ThemeContext.Provider>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { useCallback, useLayoutEffect, useState } from 'react';
|
import { useCallback, useLayoutEffect, useState } from 'react';
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { useConceptTheme } from '../../context/ThemeContext';
|
||||||
import { HelpTopic } from '../../utils/models';
|
import { HelpTopic } from '../../utils/models';
|
||||||
import TopicsList from './TopicsList';
|
import TopicsList from './TopicsList';
|
||||||
import ViewTopic from './ViewTopic';
|
import ViewTopic from './ViewTopic';
|
||||||
|
@ -8,6 +9,7 @@ import ViewTopic from './ViewTopic';
|
||||||
function ManualsPage() {
|
function ManualsPage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const search = useLocation().search;
|
const search = useLocation().search;
|
||||||
|
const { mainHeight } = useConceptTheme();
|
||||||
const [activeTopic, setActiveTopic] = useState<HelpTopic>(HelpTopic.MAIN);
|
const [activeTopic, setActiveTopic] = useState<HelpTopic>(HelpTopic.MAIN);
|
||||||
|
|
||||||
const navigateTo = useCallback(
|
const navigateTo = useCallback(
|
||||||
|
@ -31,7 +33,7 @@ function ManualsPage() {
|
||||||
}, [search, setActiveTopic, navigateTo]);
|
}, [search, setActiveTopic, navigateTo]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex w-full gap-2 justify-stretch'>
|
<div className='flex w-full gap-2 justify-stretch' style={{minHeight: mainHeight}}>
|
||||||
<TopicsList
|
<TopicsList
|
||||||
activeTopic={activeTopic}
|
activeTopic={activeTopic}
|
||||||
onChangeTopic={topic => onSelectTopic(topic)}
|
onChangeTopic={topic => onSelectTopic(topic)}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import Divider from '../../components/Common/Divider';
|
||||||
import HelpRSFormItems from '../../components/Help/HelpRSFormItems';
|
import HelpRSFormItems from '../../components/Help/HelpRSFormItems';
|
||||||
import { ArrowDownIcon, ArrowsRotateIcon, ArrowUpIcon, DumpBinIcon, HelpIcon, SmallPlusIcon } from '../../components/Icons';
|
import { ArrowDownIcon, ArrowsRotateIcon, ArrowUpIcon, DumpBinIcon, HelpIcon, SmallPlusIcon } from '../../components/Icons';
|
||||||
import { useRSForm } from '../../context/RSFormContext';
|
import { useRSForm } from '../../context/RSFormContext';
|
||||||
import { useConceptTheme } from '../../context/ThemeContext';
|
|
||||||
import { prefixes } from '../../utils/constants';
|
import { prefixes } from '../../utils/constants';
|
||||||
import { CstType, IConstituenta, ICstCreateData, ICstMovetoData } from '../../utils/models'
|
import { CstType, IConstituenta, ICstCreateData, ICstMovetoData } from '../../utils/models'
|
||||||
import { getCstTypePrefix, getCstTypeShortcut, getCstTypificationLabel, mapStatusInfo } from '../../utils/staticUI';
|
import { getCstTypePrefix, getCstTypeShortcut, getCstTypificationLabel, mapStatusInfo } from '../../utils/staticUI';
|
||||||
|
@ -21,7 +20,6 @@ interface EditorItemsProps {
|
||||||
|
|
||||||
function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps) {
|
function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps) {
|
||||||
const { schema, isEditable, cstMoveTo, resetAliases } = useRSForm();
|
const { schema, isEditable, cstMoveTo, resetAliases } = useRSForm();
|
||||||
const { noNavigation } = useConceptTheme();
|
|
||||||
const [selected, setSelected] = useState<number[]>([]);
|
const [selected, setSelected] = useState<number[]>([]);
|
||||||
const nothingSelected = useMemo(() => selected.length === 0, [selected]);
|
const nothingSelected = useMemo(() => selected.length === 0, [selected]);
|
||||||
|
|
||||||
|
@ -200,7 +198,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
reorder: true,
|
reorder: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Тип',
|
name: 'Типизация',
|
||||||
id: 'type',
|
id: 'type',
|
||||||
cell: (cst: IConstituenta) => <div style={{ fontSize: 12 }}>{getCstTypificationLabel(cst)}</div>,
|
cell: (cst: IConstituenta) => <div style={{ fontSize: 12 }}>{getCstTypificationLabel(cst)}</div>,
|
||||||
width: '175px',
|
width: '175px',
|
||||||
|
@ -256,8 +254,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
return (
|
return (
|
||||||
<div className='w-full'>
|
<div className='w-full'>
|
||||||
<div
|
<div
|
||||||
className={'flex justify-start w-full gap-1 px-2 py-1 border-y items-center h-[2.2rem] select-none clr-app' +
|
className='sticky top-0 z-10 flex justify-start w-full gap-1 px-2 py-1 border-y items-center h-[2.2rem] select-none clr-app'
|
||||||
(!noNavigation ? ' sticky z-10 top-[0rem]' : ' sticky z-10 top-[0rem]')}
|
|
||||||
>
|
>
|
||||||
<div className='mr-3 whitespace-nowrap'>
|
<div className='mr-3 whitespace-nowrap'>
|
||||||
Выбраны
|
Выбраны
|
||||||
|
|
Loading…
Reference in New Issue
Block a user