mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
* chore: memoize sorted pages * chore: make link size more precise * fix(link): disable enter press on create mode * fix(onboarding): move is base logic and use escape for single quote * fix(page): on delete success redirect to pages * fix(sntry): sentry client error report * chore(page): dynamic focus on title/content * chore(link): tweak badge class * chore(link): use nuqs for handling create mode * fix(link): refs * feat(palette): implement new link
38 lines
963 B
TypeScript
38 lines
963 B
TypeScript
"use client"
|
|
|
|
import React from "react"
|
|
import { useKey } from "react-use"
|
|
import { LinkForm } from "./partials/form/link-form"
|
|
import { motion, AnimatePresence } from "framer-motion"
|
|
import { parseAsBoolean, useQueryState } from "nuqs"
|
|
|
|
interface LinkManageProps {}
|
|
|
|
const LinkManage: React.FC<LinkManageProps> = () => {
|
|
const [createMode, setCreateMode] = useQueryState("create", parseAsBoolean)
|
|
|
|
const handleFormClose = () => setCreateMode(false)
|
|
const handleFormFail = () => {}
|
|
|
|
useKey("Escape", handleFormClose)
|
|
|
|
return (
|
|
<AnimatePresence>
|
|
{createMode && (
|
|
<motion.div
|
|
initial={{ height: 0, opacity: 0 }}
|
|
animate={{ height: "auto", opacity: 1 }}
|
|
exit={{ height: 0, opacity: 0 }}
|
|
transition={{ duration: 0.1 }}
|
|
>
|
|
<LinkForm onClose={handleFormClose} onSuccess={handleFormClose} onFail={handleFormFail} />
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
)
|
|
}
|
|
|
|
LinkManage.displayName = "LinkManage"
|
|
|
|
export { LinkManage }
|