mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-11-18 09:37:30 +01:00
chore: lint && format codebase
This commit is contained in:
@@ -24,7 +24,7 @@ export const size = {
|
||||
|
||||
export default async function Image({ params }: { params: Promise<{ icon: string }> }) {
|
||||
const { icon } = await params
|
||||
|
||||
|
||||
if (!icon) {
|
||||
return new ImageResponse(
|
||||
<div
|
||||
@@ -45,7 +45,7 @@ export default async function Image({ params }: { params: Promise<{ icon: string
|
||||
{ ...size },
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
const iconData = await getCommunitySubmissionByName(icon)
|
||||
|
||||
if (!iconData) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Metadata } from "next"
|
||||
import { Suspense } from "react"
|
||||
import { ExperimentalWarning } from "@/components/experimental-warning"
|
||||
import { CommunityIconSearch } from "@/components/community-icon-search"
|
||||
import { ExperimentalWarning } from "@/components/experimental-warning"
|
||||
import { BASE_URL } from "@/constants"
|
||||
import { getCommunitySubmissions } from "@/lib/community"
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import { getAllIcons } from "@/lib/api"
|
||||
export const dynamic = "force-static"
|
||||
export const revalidate = false
|
||||
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const iconsData = await getAllIcons()
|
||||
if (process.env.CI_MODE === "false") {
|
||||
@@ -28,7 +27,7 @@ export const size = {
|
||||
}
|
||||
export default async function Image({ params }: { params: Promise<{ icon: string }> }) {
|
||||
const { icon } = await params
|
||||
|
||||
|
||||
if (!icon) {
|
||||
console.error(`[Opengraph Image] Icon not found for ${icon}`)
|
||||
return new ImageResponse(
|
||||
@@ -50,7 +49,7 @@ export default async function Image({ params }: { params: Promise<{ icon: string
|
||||
{ ...size },
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
const iconsData = await getAllIcons()
|
||||
const totalIcons = Object.keys(iconsData).length
|
||||
const index = Object.keys(iconsData).indexOf(icon)
|
||||
@@ -72,9 +71,7 @@ export default async function Image({ params }: { params: Promise<{ icon: string
|
||||
}
|
||||
|
||||
// Convert the image data to a data URL or use placeholder
|
||||
const iconUrl = iconData
|
||||
? `data:image/png;base64,${iconData.toString("base64")}`
|
||||
: null
|
||||
const iconUrl = iconData ? `data:image/png;base64,${iconData.toString("base64")}` : null
|
||||
|
||||
return new ImageResponse(
|
||||
<div
|
||||
|
||||
@@ -4,8 +4,9 @@ import { useForm } from "@tanstack/react-form"
|
||||
import { Check, FileImage, FileType, Plus, X } from "lucide-react"
|
||||
import { useState } from "react"
|
||||
import { toast } from "sonner"
|
||||
import { IconNameCombobox } from "@/components/icon-name-combobox"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
import { ExperimentalWarning } from "@/components/experimental-warning"
|
||||
import { IconNameCombobox } from "@/components/icon-name-combobox"
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -26,7 +27,6 @@ import { Dropzone, DropzoneContent, DropzoneEmptyState } from "@/components/ui/s
|
||||
import { Textarea } from "@/components/ui/textarea"
|
||||
import { useExistingIconNames } from "@/hooks/use-submissions"
|
||||
import { pb } from "@/lib/pb"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
|
||||
interface VariantConfig {
|
||||
id: string
|
||||
@@ -298,7 +298,8 @@ export function AdvancedIconSubmissionFormTanStack() {
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Confirm Submission</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
This icon submission form is a work-in-progress and is currently in an experimentation phase. Your submission will not be reviewed or processed at this time. We're using this to gather feedback and improve the experience.
|
||||
This icon submission form is a work-in-progress and is currently in an experimentation phase. Your submission will not be
|
||||
reviewed or processed at this time. We're using this to gather feedback and improve the experience.
|
||||
<br />
|
||||
<br />
|
||||
Do you still want to proceed with submitting your icon?
|
||||
|
||||
@@ -8,6 +8,7 @@ import Link from "next/link"
|
||||
import type React from "react"
|
||||
import { useCallback, useState } from "react"
|
||||
import { toast } from "sonner"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
import { IconNameCombobox } from "@/components/icon-name-combobox"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -18,7 +19,6 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
|
||||
import { BASE_URL, REPO_PATH } from "@/constants"
|
||||
import { pb } from "@/lib/pb"
|
||||
import { formatIconName } from "@/lib/utils"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
import { MagicCard } from "./magicui/magic-card"
|
||||
import { Badge } from "./ui/badge"
|
||||
import { Dropzone, DropzoneContent, DropzoneEmptyState } from "./ui/shadcn-io/dropzone"
|
||||
|
||||
@@ -16,9 +16,7 @@ export function ExperimentalWarning({ message }: ExperimentalWarningProps) {
|
||||
<AlertTriangle className="text-amber-600 dark:text-amber-500 size-8" />
|
||||
<div className="col-start-2 space-y-4">
|
||||
<AlertTitle className="text-amber-900 dark:text-amber-100 text-2xl font-bold">Experimental Feature</AlertTitle>
|
||||
<AlertDescription className="text-amber-800 dark:text-amber-200 text-base leading-relaxed">
|
||||
{defaultMessage}
|
||||
</AlertDescription>
|
||||
<AlertDescription className="text-amber-800 dark:text-amber-200 text-base leading-relaxed">{defaultMessage}</AlertDescription>
|
||||
<Button className="feedback-button mt-4" variant="outline" size="lg">
|
||||
Send feedback
|
||||
</Button>
|
||||
@@ -26,4 +24,3 @@ export function ExperimentalWarning({ message }: ExperimentalWarningProps) {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import { toast } from "sonner"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
import { getAllIcons } from "@/lib/api"
|
||||
import { pb, type Submission } from "@/lib/pb"
|
||||
import { revalidateAllSubmissions } from "@/app/actions/submissions"
|
||||
|
||||
// Query key factory
|
||||
export const submissionKeys = {
|
||||
|
||||
@@ -127,19 +127,15 @@ async function fetchAuthorData(authorId: number) {
|
||||
* Uses unstable_cache with tags for on-demand revalidation
|
||||
* Revalidates every 86400 seconds (24 hours)
|
||||
* Cache key: author-{authorId}
|
||||
*
|
||||
*
|
||||
* This prevents hitting GitHub API rate limits by caching author data
|
||||
* across multiple page builds and requests.
|
||||
*/
|
||||
export async function getAuthorData(authorId: number): Promise<AuthorData> {
|
||||
return unstable_cache(
|
||||
async () => await fetchAuthorData(authorId),
|
||||
[`author-${authorId}`],
|
||||
{
|
||||
revalidate: 86400,
|
||||
tags: ["authors", `author-${authorId}`],
|
||||
}
|
||||
)()
|
||||
return unstable_cache(async () => await fetchAuthorData(authorId), [`author-${authorId}`], {
|
||||
revalidate: 86400,
|
||||
tags: ["authors", `author-${authorId}`],
|
||||
})()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,3 @@ export class ApiError extends Error {
|
||||
this.status = status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user