feat: port stroy-bot-main as the hub page
Project picker, section cards and the period Excel export now live on the app's home page. The selected project is shared app state, so the sidebar hides sections with the same rules main used to disable its cards (archived, finished, no edit0 right). Queries are 1:1 with stroy-bot-main and covered by tests against a fake HTTP client. Behaviour differences are listed in the migration checklist. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import * as React from 'react';
|
||||
import { useOutsideClose } from '../../shared/hooks/useOutsideClose';
|
||||
import { HUB_TEXTS } from './texts';
|
||||
import styles from './HubPage.module.scss';
|
||||
|
||||
const TEXTS = HUB_TEXTS.export;
|
||||
|
||||
/** Кнопка «?» с подсказкой о типах отчётов. Закрывается повторным кликом, кликом мимо или Esc. */
|
||||
export const ExportInfoButton: React.FC = () => {
|
||||
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
||||
const wrapperRef = React.useRef<HTMLSpanElement>(null);
|
||||
|
||||
useOutsideClose(wrapperRef, isOpen, () => setIsOpen(false));
|
||||
|
||||
return (
|
||||
<span className={styles.infoWrapper} ref={wrapperRef}>
|
||||
<button
|
||||
type="button"
|
||||
className={styles.infoButton}
|
||||
aria-label={TEXTS.infoAriaLabel}
|
||||
aria-expanded={isOpen}
|
||||
onClick={() => setIsOpen((prev) => !prev)}
|
||||
>
|
||||
?
|
||||
</button>
|
||||
{isOpen && (
|
||||
<span className={styles.infoPopover} role="tooltip">
|
||||
{TEXTS.infoRows.map((row) => (
|
||||
<span key={row.label} className={styles.infoRow}>
|
||||
<strong>{row.label}</strong> {row.text}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user