mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
Refactor imports and animations for consistency and performance improvements
This commit is contained in:
+3
-1
@@ -2,7 +2,9 @@
|
||||
import { withAxiom } from '@civitai/next-axiom';
|
||||
import bundlAnalyzer from '@next/bundle-analyzer';
|
||||
import CircularDependencyPlugin from 'circular-dependency-plugin';
|
||||
import packageJson from './package.json' assert { type: 'json' };
|
||||
import { createRequire } from 'module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const packageJson = require('./package.json');
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
@@ -2,8 +2,8 @@ import type { FlexProps } from '@mantine/core';
|
||||
import { Flex } from '@mantine/core';
|
||||
import type { LottieComponentProps } from 'lottie-react';
|
||||
import Lottie from 'lottie-react';
|
||||
import * as levelAnimation from '~/utils/lotties/level-up-animation.json';
|
||||
import * as rankAnimation from '~/utils/lotties/rank-up-animation.json';
|
||||
import levelAnimation from '~/utils/lotties/level-up-animation.json';
|
||||
import rankAnimation from '~/utils/lotties/rank-up-animation.json';
|
||||
|
||||
export function LevelAnimation({ lottieProps, type = 'level', ...props }: Props) {
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FlexProps } from '@mantine/core';
|
||||
import { Flex } from '@mantine/core';
|
||||
import type { LottieComponentProps } from 'lottie-react';
|
||||
import Lottie from 'lottie-react';
|
||||
import * as linkAnimation from '~/utils/lotties/link-animation.json';
|
||||
import linkAnimation from '~/utils/lotties/link-animation.json';
|
||||
|
||||
export function LinkAnimation({ lottieProps, ...props }: Props) {
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FlexProps } from '@mantine/core';
|
||||
import { Flex } from '@mantine/core';
|
||||
import type { LottieComponentProps } from 'lottie-react';
|
||||
import Lottie from 'lottie-react';
|
||||
import * as successAnimation from '~/utils/lotties/success-animation.json';
|
||||
import successAnimation from '~/utils/lotties/success-animation.json';
|
||||
|
||||
export function SuccessAnimation({
|
||||
direction = 'column',
|
||||
|
||||
@@ -227,7 +227,9 @@
|
||||
height: calc(100% + 4px);
|
||||
filter: blur(8px);
|
||||
z-index: -1;
|
||||
animation: glowing 20s linear infinite;
|
||||
& :global {
|
||||
animation: glowing 20s linear infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
overflow: visible;
|
||||
animation: fadeOut 500ms ease-in 2s forwards;
|
||||
will-change: opacity;
|
||||
& :global {
|
||||
animation: fadeOut 500ms ease-in 2s forwards;
|
||||
will-change: opacity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export declare const fadeOut: string;
|
||||
export declare const levelUp: string;
|
||||
export declare const raterBadge: string;
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
background-position: -300% 50%;
|
||||
background-repeat: no-repeat;
|
||||
color: light-dark(var(--mantine-color-yellow-8), var(--mantine-color-yellow-3));
|
||||
animation: global(button-highlight) 5s linear infinite;
|
||||
will-change: background-position;
|
||||
|
||||
& :global {
|
||||
animation: button-highlight 5s linear infinite;
|
||||
will-change: background-position;
|
||||
}
|
||||
}
|
||||
|
||||
.tabRainbow {
|
||||
|
||||
@@ -144,8 +144,7 @@ export function HomeTabs() {
|
||||
['bg-gray-4 dark:bg-dark-4']:
|
||||
activePath === key || (activePath === 'changelog' && key === 'updates'),
|
||||
[classes.groupedOptions]: value.grouped,
|
||||
[classes.tabRainbow]: key === 'shop',
|
||||
[animationClasses.rainbowBackground]: key === 'shop',
|
||||
[classes.tabHighlight]: key === 'shop',
|
||||
})}
|
||||
classNames={{ label: 'flex gap-2 items-center capitalize overflow-visible' }}
|
||||
>
|
||||
|
||||
@@ -30,6 +30,7 @@ export const contentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -90,6 +91,7 @@ export const contentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -111,6 +113,7 @@ export const contentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -175,6 +178,7 @@ export const contentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -195,6 +199,7 @@ export const contentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -227,6 +232,7 @@ export const remixContentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -251,6 +257,7 @@ export const remixContentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -315,6 +322,7 @@ export const remixContentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -335,6 +343,7 @@ export const remixContentGenerationTour: StepWithData[] = [
|
||||
styles: {
|
||||
spotlight: {
|
||||
animation: 'shadowGlow 2s infinite',
|
||||
willChange: 'box-shadow',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -726,7 +726,8 @@ async function updateImageScanJobs({
|
||||
${ingestion ? `"ingestion" = '${ingestion}',` : ''}
|
||||
${nsfwLevel ? `"nsfwLevel" = ${nsfwLevel},` : ''}
|
||||
${blockedFor ? `"blockedFor" = '${blockedFor}',` : ''}
|
||||
${aiRating ? `"aiNsfwLevel" = ${aiRating}, "aiModel" = '${aiModel}',` : ''}
|
||||
${aiRating ? `"aiNsfwLevel" = ${aiRating},` : ''}
|
||||
${aiModel ? `"aiModel" = '${aiModel}',` : ''}
|
||||
"scanJobs" = jsonb_set(COALESCE("scanJobs", '{}'), '{scans}', COALESCE("scanJobs"->'scans', '{}') || '{"${source}": ${Date.now()}}'::jsonb)
|
||||
WHERE id = ${id}
|
||||
RETURNING "scanJobs";
|
||||
|
||||
@@ -44,7 +44,7 @@ export const auditMetaData = (meta: ImageMetaProps | undefined, nsfw: boolean) =
|
||||
// Add minor check
|
||||
if (nsfw) {
|
||||
const { found, age } = includesMinorAge(prompt);
|
||||
if (found) return { blockedFor: [`${age} year old`], success: false };
|
||||
if (found && age != null) return { blockedFor: [`${age} year old`], success: false };
|
||||
}
|
||||
|
||||
const blockList = nsfw ? blockedNSFWRegex : blockedRegex;
|
||||
@@ -59,7 +59,7 @@ export const auditPrompt = (prompt: string, negativePrompt?: string) => {
|
||||
prompt = normalizeText(prompt); // Parse HTML Entities
|
||||
negativePrompt = normalizeText(negativePrompt);
|
||||
const { found, age } = includesMinorAge(prompt);
|
||||
if (found) return { blockedFor: [`${age} year old`], success: false };
|
||||
if (found && age != null) return { blockedFor: [`${age} year old`], success: false };
|
||||
|
||||
if (includesPoi(prompt)) {
|
||||
return { blockedFor: ['Prompt cannot include celebrity names'], success: false };
|
||||
|
||||
Reference in New Issue
Block a user