mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-05 20:15:31 -04:00
refactor: migrate from Biome to oxlint/oxfmt, remove contact form
- Replace Biome with oxlint + oxfmt (OXC toolchain) for linting and formatting - Add .oxlintrc.json and .oxfmtrc.json configuration files - Update VS Code settings and devcontainer to use oxc-vscode extension - Remove contact form, Resend email integration, and related server action/schema - Remove unused UI components (accordion, alert, card, tabs, toggle, etc.)
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { InfoIcon, Loader2Icon } from "lucide-react";
|
||||
import { createContext, useContext, useState, useTransition } from "react";
|
||||
import { createContext, useContext, useMemo, useState, useTransition } from "react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { MarkdownIcon } from "@/components/icons";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useSession } from "@/lib/auth-client";
|
||||
import { createComment, updateComment } from "@/lib/server/comments";
|
||||
|
||||
import { CommentAvatar } from "./comment-avatar";
|
||||
|
||||
// Context for lifting form state to parent components
|
||||
@@ -36,13 +34,12 @@ const CommentFormProvider = ({
|
||||
const [content, setContent] = useState(initialContent);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
return (
|
||||
<CommentFormContext.Provider
|
||||
value={{ content, setContent, isPending, startTransition }}
|
||||
>
|
||||
{children}
|
||||
</CommentFormContext.Provider>
|
||||
const contextValue = useMemo(
|
||||
() => ({ content, setContent, isPending, startTransition }),
|
||||
[content, setContent, isPending, startTransition],
|
||||
);
|
||||
|
||||
return <CommentFormContext.Provider value={contextValue}>{children}</CommentFormContext.Provider>;
|
||||
};
|
||||
|
||||
// Hook to access form state from context (for sibling components like preview panels)
|
||||
@@ -136,18 +133,20 @@ const SubmitButton = ({
|
||||
|
||||
// Markdown help popover (only shown for new comments)
|
||||
const MarkdownHelp = () => (
|
||||
<p className="text-[0.8rem] text-muted-foreground leading-relaxed">
|
||||
<p className="text-muted-foreground text-[0.8rem] leading-relaxed">
|
||||
<MarkdownIcon className="mr-1.5 inline-block size-4 align-text-top" />
|
||||
<span className="max-md:hidden">Basic </span>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="cursor-pointer font-semibold text-primary no-underline decoration-2 decoration-primary/40 underline-offset-4 hover:underline"
|
||||
>
|
||||
<span>Markdown</span>
|
||||
<span className="max-md:hidden"> syntax</span>
|
||||
</button>
|
||||
<PopoverTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
className="text-primary decoration-primary/40 cursor-pointer font-semibold no-underline decoration-2 underline-offset-4 hover:underline"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<span>Markdown</span>
|
||||
<span className="max-md:hidden"> syntax</span>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start">
|
||||
<p className="text-sm leading-loose">
|
||||
@@ -155,7 +154,7 @@ const MarkdownHelp = () => (
|
||||
Examples:
|
||||
</p>
|
||||
|
||||
<ul className="my-2 list-inside list-disc pl-1 text-sm [&>li::marker]:font-normal [&>li::marker]:text-muted-foreground [&>li]:my-1.5 [&>li]:text-nowrap [&>li]:pl-1">
|
||||
<ul className="[&>li::marker]:text-muted-foreground my-2 list-inside list-disc pl-1 text-sm [&>li]:my-1.5 [&>li]:pl-1 [&>li]:text-nowrap [&>li::marker]:font-normal">
|
||||
<li>
|
||||
<span className="font-bold">**bold**</span>
|
||||
</li>
|
||||
@@ -164,18 +163,13 @@ const MarkdownHelp = () => (
|
||||
</li>
|
||||
<li>
|
||||
[
|
||||
<a
|
||||
href="https://jarv.is"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
className="hover:no-underline"
|
||||
>
|
||||
<a href="https://jarv.is" target="_blank" rel="noopener" className="hover:no-underline">
|
||||
links
|
||||
</a>
|
||||
](https://jarv.is)
|
||||
</li>
|
||||
<li>
|
||||
<span className="rounded-sm bg-muted px-[0.3rem] py-[0.2rem] font-medium font-mono text-sm">
|
||||
<span className="bg-muted rounded-sm px-[0.3rem] py-[0.2rem] font-mono text-sm font-medium">
|
||||
`code`
|
||||
</span>
|
||||
</li>
|
||||
@@ -203,8 +197,7 @@ const MarkdownHelp = () => (
|
||||
|
||||
// New comment form - for creating top-level comments
|
||||
const NewCommentForm = ({ slug }: { slug: string }) => {
|
||||
const { content, setContent, isPending, startTransition } =
|
||||
useCommentFormState();
|
||||
const { content, setContent, isPending, startTransition } = useCommentFormState();
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
@@ -269,8 +262,7 @@ const ReplyForm = ({
|
||||
onCancel: () => void;
|
||||
onSuccess?: () => void;
|
||||
}) => {
|
||||
const { content, setContent, isPending, startTransition } =
|
||||
useCommentFormState();
|
||||
const { content, setContent, isPending, startTransition } = useCommentFormState();
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
@@ -308,12 +300,7 @@ const ReplyForm = ({
|
||||
/>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={onCancel}
|
||||
disabled={isPending}
|
||||
>
|
||||
<Button type="button" variant="outline" onClick={onCancel} disabled={isPending}>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
@@ -345,8 +332,7 @@ const EditCommentForm = ({
|
||||
onCancel: () => void;
|
||||
onSuccess?: () => void;
|
||||
}) => {
|
||||
const { content, setContent, isPending, startTransition } =
|
||||
useCommentFormState(initialContent);
|
||||
const { content, setContent, isPending, startTransition } = useCommentFormState(initialContent);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
@@ -369,12 +355,7 @@ const EditCommentForm = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="space-y-4"
|
||||
data-intent="edit"
|
||||
data-slug={slug}
|
||||
>
|
||||
<form onSubmit={handleSubmit} className="space-y-4" data-intent="edit" data-slug={slug}>
|
||||
<div className="min-w-0 flex-1 space-y-4">
|
||||
<CommentTextarea
|
||||
content={content}
|
||||
@@ -385,20 +366,11 @@ const EditCommentForm = ({
|
||||
/>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={onCancel}
|
||||
disabled={isPending}
|
||||
>
|
||||
<Button type="button" variant="outline" onClick={onCancel} disabled={isPending}>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<SubmitButton
|
||||
isPending={isPending}
|
||||
disabled={!content.trim()}
|
||||
pendingLabel="Updating..."
|
||||
>
|
||||
<SubmitButton isPending={isPending} disabled={!content.trim()} pendingLabel="Updating...">
|
||||
Edit
|
||||
</SubmitButton>
|
||||
</div>
|
||||
@@ -407,10 +379,4 @@ const EditCommentForm = ({
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
NewCommentForm,
|
||||
ReplyForm,
|
||||
EditCommentForm,
|
||||
CommentFormProvider,
|
||||
useCommentForm,
|
||||
};
|
||||
export { NewCommentForm, ReplyForm, EditCommentForm, CommentFormProvider, useCommentForm };
|
||||
|
||||
Reference in New Issue
Block a user