Migrate to npm-workspaces monorepo (#294)

* spec update

* update md files

* add plan: monorepo

* feat: add empty apps and packages directories

* Add shared tsconfig.base.json

* feat add workspaces

* feat: move hudozka-writer into apps/

* feat: move migrate-to-pocketbase into apps/

* feat: split package.json for apps/hudozka workspace

* feat: extend tsconfig.base.json in apps/hudozka

* add dockerfile path

* feat: verify Phase 3 monorepo migration of Next app

* feat: scaffold @hudozka/utils package

* feat: add utils barrel export

* feat: extract utilities into hudozka-utils package

* feat: extract hooks into hudozka-hooks package

* Extract Box/Button/Panel/Title/Overlay into @hudozka/ui

* Scope Next ESLint rules to apps/hudozka in root flat config

* Update README and CLAUDE.md for monorepo layout

* disable image optimisation
This commit is contained in:
tmshv authored and GitHub committed 2026-04-25 01:33:06 +03:00
1 parent 0665fa7ae7
commit f874b58dd9
258 files changed
+3793 -214

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
export type TransitionProps = {
children?: React.ReactNode
duration: number
extraStyle?: React.CSSProperties
show: boolean
}
export function Transition(props: TransitionProps) {
const [mounted, setMounted] = useState(props.show)
const [opacity, setOpacity] = useState(0)
const timerRef = useRef<ReturnType<typeof setTimeout>>(null)
const onTransitionEnd = useCallback(() => {
if (opacity === 0) {
setMounted(false)
}
}, [opacity])
const transition = useMemo(
() => `all ${props.duration}ms`,
[props.duration],
)
if (props.show && !mounted) {
setMounted(true)
}
if (!props.show && opacity !== 0) {
setOpacity(0)
}
useEffect(() => {
if (!props.show) {
return
}
timerRef.current = setTimeout(() => {
setOpacity(1)
}, 16)
return () => {
if (timerRef.current) {
clearTimeout(timerRef.current)
}
}
}, [props.show])
if (!mounted) {
return null
}
return (
<div
style={{
...props.extraStyle,
opacity,
transition,
}}
onTransitionEnd={onTransitionEnd}
>
{props.children}
</div>
)
}
+38
View File
@@ -0,0 +1,38 @@
import s from "./styles.module.css"
import { Transition } from "./Transition"
import { useLockBodyScroll, useReducedMotion } from "@hudozka/hooks"
export type OverlayProps = {
children?: React.ReactNode
show: boolean
onClickOverlay: () => void
style?: React.CSSProperties
duration: number
}
export const Overlay: React.FC<OverlayProps> = props => {
const motionDisabled = useReducedMotion()
const duration = motionDisabled ? 0 : props.duration
useLockBodyScroll(props.show)
return (
<Transition
duration={duration}
show={props.show}
>
<div
onClick={(event) => {
if (event.target === event.currentTarget) {
props.onClickOverlay()
}
}}
className={s.overlay}
style={props.style}
>
{props.children}
</div>
</Transition>
)
}
+11
View File
@@ -0,0 +1,11 @@
.overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow-y: auto;
z-index: 1000000;
background-color: var(--color-back-main);
}