mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-06 20:15:17 +02:00
chore: ran linting
This commit is contained in:
parent
323f7f2b4a
commit
c674fb3054
37 changed files with 972 additions and 920 deletions
|
|
@ -4,9 +4,9 @@ import { ExternalLinkIcon, ImageIcon, SparklesIcon } from "lucide-react";
|
|||
import NextImage from "next/image";
|
||||
import { Component, type ReactNode, useState } from "react";
|
||||
import { z } from "zod";
|
||||
import { TextShimmerLoader } from "@/components/prompt-kit/loader";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { TextShimmerLoader } from "@/components/prompt-kit/loader";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/**
|
||||
|
|
@ -145,14 +145,14 @@ export class ImageErrorBoundary extends Component<
|
|||
render() {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
<Card className="w-full max-w-md overflow-hidden rounded-2xl border-0 shadow-none select-none">
|
||||
<div className="aspect-square bg-muted flex items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-2 text-muted-foreground">
|
||||
<ImageIcon className="size-8" />
|
||||
<p className="text-sm">Failed to load image</p>
|
||||
<Card className="w-full max-w-md overflow-hidden rounded-2xl border-0 shadow-none select-none">
|
||||
<div className="aspect-square bg-muted flex items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-2 text-muted-foreground">
|
||||
<ImageIcon className="size-8" />
|
||||
<p className="text-sm">Failed to load image</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +165,10 @@ export class ImageErrorBoundary extends Component<
|
|||
*/
|
||||
export function ImageSkeleton({ maxWidth = "512px" }: { maxWidth?: string }) {
|
||||
return (
|
||||
<Card className="w-full overflow-hidden rounded-2xl border-0 shadow-none select-none animate-pulse" style={{ maxWidth }}>
|
||||
<Card
|
||||
className="w-full overflow-hidden rounded-2xl border-0 shadow-none select-none animate-pulse"
|
||||
style={{ maxWidth }}
|
||||
>
|
||||
<div className="aspect-square bg-muted flex items-center justify-center">
|
||||
<ImageIcon className="size-12 text-muted-foreground/30" />
|
||||
</div>
|
||||
|
|
@ -176,9 +179,18 @@ export function ImageSkeleton({ maxWidth = "512px" }: { maxWidth?: string }) {
|
|||
/**
|
||||
* Image Loading State
|
||||
*/
|
||||
export function ImageLoading({ title = "Loading", maxWidth = "512px" }: { title?: string; maxWidth?: string }) {
|
||||
export function ImageLoading({
|
||||
title = "Loading",
|
||||
maxWidth = "512px",
|
||||
}: {
|
||||
title?: string;
|
||||
maxWidth?: string;
|
||||
}) {
|
||||
return (
|
||||
<Card className="w-full overflow-hidden rounded-2xl border-0 shadow-none select-none" style={{ maxWidth }}>
|
||||
<Card
|
||||
className="w-full overflow-hidden rounded-2xl border-0 shadow-none select-none"
|
||||
style={{ maxWidth }}
|
||||
>
|
||||
<div className="aspect-square bg-muted flex items-center justify-center">
|
||||
<TextShimmerLoader text={title} size="md" />
|
||||
</div>
|
||||
|
|
@ -212,7 +224,7 @@ export function Image({
|
|||
const [imageError, setImageError] = useState(false);
|
||||
const [imageLoaded, setImageLoaded] = useState(false);
|
||||
const isGenerated = domain === "ai-generated";
|
||||
const displayDomain = isGenerated ? "AI Generated" : (domain || source?.label);
|
||||
const displayDomain = isGenerated ? "AI Generated" : domain || source?.label;
|
||||
const isAutoRatio = !ratio || ratio === "auto";
|
||||
|
||||
const handleClick = () => {
|
||||
|
|
@ -224,7 +236,14 @@ export function Image({
|
|||
|
||||
if (imageError) {
|
||||
return (
|
||||
<Card id={id} className={cn("w-full overflow-hidden rounded-2xl border-0 shadow-none select-none", className)} style={{ maxWidth }}>
|
||||
<Card
|
||||
id={id}
|
||||
className={cn(
|
||||
"w-full overflow-hidden rounded-2xl border-0 shadow-none select-none",
|
||||
className
|
||||
)}
|
||||
style={{ maxWidth }}
|
||||
>
|
||||
<div className="aspect-square bg-muted flex items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-2 text-muted-foreground">
|
||||
<ImageIcon className="size-8" />
|
||||
|
|
@ -259,11 +278,11 @@ export function Image({
|
|||
{isAutoRatio ? (
|
||||
/* Auto ratio: image renders at natural dimensions, no cropping */
|
||||
<>
|
||||
{!imageLoaded && (
|
||||
<div className="aspect-square flex items-center justify-center">
|
||||
<TextShimmerLoader text="Loading" size="md" />
|
||||
</div>
|
||||
)}
|
||||
{!imageLoaded && (
|
||||
<div className="aspect-square flex items-center justify-center">
|
||||
<TextShimmerLoader text="Loading" size="md" />
|
||||
</div>
|
||||
)}
|
||||
<NextImage
|
||||
src={src}
|
||||
alt={alt}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue