mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-26 00:49:17 +01:00
Merge pull request #27 from caranicas/beta-react-i18n-lint
Beta react i18n lint
This commit is contained in:
commit
1210313e7f
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
84
ui/frontend/build_src/.eslintrc.cjs
Normal file
84
ui/frontend/build_src/.eslintrc.cjs
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2021: true,
|
||||||
|
},
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
plugins: ["react"],
|
||||||
|
extends: [
|
||||||
|
"plugin:react/recommended",
|
||||||
|
"standard-with-typescript",
|
||||||
|
"plugin:i18next/recommended",
|
||||||
|
"plugin:i18n-json/recommended",
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// general things turned off for now
|
||||||
|
"prefer-const": "off",
|
||||||
|
"no-debugger": "warn",
|
||||||
|
|
||||||
|
"comma-dangle": ["off", "always-multiline"],
|
||||||
|
"no-void": ["off"],
|
||||||
|
"array-callback-return": ["off"],
|
||||||
|
|
||||||
|
"react/display-name": "warn",
|
||||||
|
quotes: ["off", "double"],
|
||||||
|
semi: ["off", "always"],
|
||||||
|
"no-multiple-empty-lines": ["off", { max: 2, maxEOF: 1 }],
|
||||||
|
yoda: ["off"],
|
||||||
|
eqeqeq: ["off"],
|
||||||
|
"spaced-comment": ["off"],
|
||||||
|
|
||||||
|
// TS things turned off for now
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/no-array-constructor": "off",
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
|
"@typescript-eslint/naming-convention": "off",
|
||||||
|
"@typescript-eslint/restrict-template-expressions": "off",
|
||||||
|
"@typescript-eslint/prefer-optional-chain": "off",
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "off",
|
||||||
|
"@typescript-eslint/comma-dangle": "off",
|
||||||
|
"@typescript-eslint/quotes": "off",
|
||||||
|
"@typescript-eslint/semi": "off",
|
||||||
|
"@typescript-eslint/restrict-plus-operands": "off",
|
||||||
|
"@typescript-eslint/brace-style": "off",
|
||||||
|
"@typescript-eslint/prefer-ts-expect-error": "off",
|
||||||
|
"@typescript-eslint/indent": "off",
|
||||||
|
"@typescript-eslint/member-delimiter-style": "off",
|
||||||
|
"@typescript-eslint/prefer-includes": "off",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "off",
|
||||||
|
"@typescript-eslint/no-unnecessary-condition": "off",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
||||||
|
"@typescript-eslint/space-before-function-paren": "off",
|
||||||
|
|
||||||
|
// i18n stuff no string literal works
|
||||||
|
"i18next/no-literal-string": "warn",
|
||||||
|
// still need to figure out how to get this to work
|
||||||
|
"i18n-json/identical-keys": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
filePath: {
|
||||||
|
"home.json/": path.resolve("./Translation/locales/en/home.json"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["*.ts", "*.tsx"],
|
||||||
|
parserOptions: {
|
||||||
|
project: ["./tsconfig.json"], // Specify it only for TypeScript files
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// eslint-disable-next-line semi
|
||||||
|
};
|
4911
ui/frontend/build_src/package-lock.json
generated
4911
ui/frontend/build_src/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"lint": "eslint --ext .tsx --fix src",
|
||||||
"pretty": "prettier --write .",
|
"pretty": "prettier --write .",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build --emptyOutDir",
|
"build": "tsc && vite build --emptyOutDir",
|
||||||
@ -29,10 +30,21 @@
|
|||||||
"@types/react": "^18.0.17",
|
"@types/react": "^18.0.17",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
||||||
|
"@typescript-eslint/parser": "^5.37.0",
|
||||||
"@vitejs/plugin-react": "^2.0.1",
|
"@vitejs/plugin-react": "^2.0.1",
|
||||||
|
"eslint": "^8.23.1",
|
||||||
|
"eslint-config-standard-with-typescript": "^23.0.0",
|
||||||
|
"eslint-plugin-i18n-json": "^4.0.0",
|
||||||
|
"eslint-plugin-i18next": "^6.0.0-4",
|
||||||
|
"eslint-plugin-import": "^2.26.0",
|
||||||
|
"eslint-plugin-n": "^15.2.5",
|
||||||
|
"eslint-plugin-promise": "^6.0.1",
|
||||||
|
"eslint-plugin-react": "^7.31.8",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"typescript": "^4.6.4",
|
"typescript": "^4.8.3",
|
||||||
"vite": "^3.0.7"
|
"vite": "^3.0.7",
|
||||||
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@vanilla-extract/vite-plugin": {
|
"@vanilla-extract/vite-plugin": {
|
||||||
|
7
ui/frontend/build_src/prettier.cjs
Normal file
7
ui/frontend/build_src/prettier.cjs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
singleQuote: true,
|
||||||
|
tabWidth: 2,
|
||||||
|
semi: true,
|
||||||
|
trailingComma: "es5",
|
||||||
|
endOfLine: "lf",
|
||||||
|
};
|
@ -1,17 +1,15 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { ReactLocation, Router } from "@tanstack/react-location";
|
import { ReactLocation, Router } from "@tanstack/react-location";
|
||||||
|
|
||||||
import Home from "./pages/Home";
|
import Home from "./pages/Home";
|
||||||
import Settings from "./pages/Settings";
|
import Settings from "./pages/Settings";
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
import { darkTheme, lightTheme } from "./styles/theme/index.css.ts";
|
import { darkTheme, lightTheme } from "./styles/theme/index.css.ts";
|
||||||
|
import "./Translation/config";
|
||||||
import './Translation/config';
|
|
||||||
|
|
||||||
const location = new ReactLocation();
|
const location = new ReactLocation();
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
// just check for the theme one 1 time
|
// just check for the theme one 1 time
|
||||||
|
|
||||||
// var { matches } = window.matchMedia('(prefers-color-scheme: dark)')
|
// var { matches } = window.matchMedia('(prefers-color-scheme: dark)')
|
||||||
const matches = true;
|
const matches = true;
|
||||||
const themeClass = matches ? darkTheme : lightTheme;
|
const themeClass = matches ? darkTheme : lightTheme;
|
||||||
@ -23,8 +21,7 @@ function App() {
|
|||||||
{ path: "/", element: <Home className={themeClass} /> },
|
{ path: "/", element: <Home className={themeClass} /> },
|
||||||
{ path: "/settings", element: <Settings className={themeClass} /> },
|
{ path: "/settings", element: <Settings className={themeClass} /> },
|
||||||
]}
|
]}
|
||||||
>
|
></Router>
|
||||||
</Router>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import translation from "./en.json";
|
// this should be updated to an interface
|
||||||
|
import translation from "./locales/en/home.json";
|
||||||
import { initReactI18next } from "react-i18next";
|
import { initReactI18next } from "react-i18next";
|
||||||
|
|
||||||
export const resources = {
|
export const resources = {
|
||||||
|
20
ui/frontend/build_src/src/Translation/locales/es/home.json
Normal file
20
ui/frontend/build_src/src/Translation/locales/es/home.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"title": "Stable Diffusion UI",
|
||||||
|
"description": "",
|
||||||
|
"navbar": {},
|
||||||
|
"land-cre": {},
|
||||||
|
"land-pre": {},
|
||||||
|
"home": {},
|
||||||
|
"in-paint": {},
|
||||||
|
"settings": {},
|
||||||
|
"tags": {},
|
||||||
|
"preview-prompt": {},
|
||||||
|
"current-task": "",
|
||||||
|
"recent-create": "",
|
||||||
|
"popup": {},
|
||||||
|
"history": {},
|
||||||
|
"advanced-settings": {},
|
||||||
|
"storage": {},
|
||||||
|
"import": {},
|
||||||
|
"about": ""
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useImageCreate } from "../../../stores/imageCreateStore";
|
import { useImageCreate } from "../../../stores/imageCreateStore";
|
||||||
|
|
||||||
type ModifierTagProps = {
|
interface ModifierTagProps {
|
||||||
name: string;
|
name: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function ModifierTag({ name }: ModifierTagProps) {
|
export default function ModifierTag({ name }: ModifierTagProps) {
|
||||||
const hasTag = useImageCreate((state) => state.hasTag(name))
|
const hasTag = useImageCreate((state) => state.hasTag(name))
|
||||||
|
@ -24,7 +24,7 @@ export default function BetaMode() {
|
|||||||
// the toggle config
|
// the toggle config
|
||||||
const { status: toggleStatus, data: toggleData } = useQuery(
|
const { status: toggleStatus, data: toggleData } = useQuery(
|
||||||
[KEY_TOGGLE_CONFIG],
|
[KEY_TOGGLE_CONFIG],
|
||||||
() => toggleBetaConfig(branchToGetNext),
|
async () => await toggleBetaConfig(branchToGetNext),
|
||||||
{
|
{
|
||||||
enabled: shouldSetCofig,
|
enabled: shouldSetCofig,
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ export default function BetaMode() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (toggleStatus === "success") {
|
if (toggleStatus === "success") {
|
||||||
if (toggleData[0] == "OK") {
|
if (toggleData[0] === "OK") {
|
||||||
// force a refetch of the config
|
// force a refetch of the config
|
||||||
queryClient.invalidateQueries([KEY_CONFIG]);
|
queryClient.invalidateQueries([KEY_CONFIG]);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React, { useRef, useState, useEffect } from "react";
|
import React, { useRef, useState, useEffect } from "react";
|
||||||
|
|
||||||
|
import {
|
||||||
|
DrawImageMain, // @ts-expect-error
|
||||||
|
} from "./drawImage.css.ts";
|
||||||
|
|
||||||
// https://github.com/embiem/react-canvas-draw
|
// https://github.com/embiem/react-canvas-draw
|
||||||
|
|
||||||
type DrawImageProps = {
|
interface DrawImageProps {
|
||||||
imageData: string;
|
imageData: string;
|
||||||
brushSize: string;
|
brushSize: string;
|
||||||
|
|
||||||
brushShape: string;
|
brushShape: string;
|
||||||
brushColor: string;
|
brushColor: string;
|
||||||
isErasing: boolean;
|
isErasing: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
import {
|
|
||||||
DrawImageMain, //@ts-ignore
|
|
||||||
} from "./drawImage.css.ts";
|
|
||||||
|
|
||||||
export default function DrawImage({
|
export default function DrawImage({
|
||||||
imageData,
|
imageData,
|
||||||
@ -42,7 +42,7 @@ export default function DrawImage({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// when the brush color changes, change the color of all the
|
// when the brush color changes, change the color of all the
|
||||||
// drawn pixels to the new color
|
// drawn pixels to the new color
|
||||||
if (drawingRef.current) {
|
if (drawingRef.current != null) {
|
||||||
const ctx = drawingRef.current.getContext("2d");
|
const ctx = drawingRef.current.getContext("2d");
|
||||||
const imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight);
|
const imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight);
|
||||||
const data = imageData.data;
|
const data = imageData.data;
|
||||||
@ -72,7 +72,7 @@ export default function DrawImage({
|
|||||||
) => {
|
) => {
|
||||||
setIsUpdating(false);
|
setIsUpdating(false);
|
||||||
const canvas = drawingRef.current;
|
const canvas = drawingRef.current;
|
||||||
if (canvas) {
|
if (canvas != null) {
|
||||||
const data = canvas.toDataURL();
|
const data = canvas.toDataURL();
|
||||||
// TODO: SEND THIS TO THE STATE
|
// TODO: SEND THIS TO THE STATE
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ export default function DrawImage({
|
|||||||
|
|
||||||
const _drawCanvas = (x, y, brushSize, brushShape, brushColor) => {
|
const _drawCanvas = (x, y, brushSize, brushShape, brushColor) => {
|
||||||
const canvas = drawingRef.current;
|
const canvas = drawingRef.current;
|
||||||
if (canvas) {
|
if (canvas != null) {
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
if (isErasing) {
|
if (isErasing) {
|
||||||
// stack overflow https://stackoverflow.com/questions/10396991/clearing-circular-regions-from-html5-canvas
|
// stack overflow https://stackoverflow.com/questions/10396991/clearing-circular-regions-from-html5-canvas
|
||||||
@ -101,7 +101,7 @@ export default function DrawImage({
|
|||||||
|
|
||||||
const _drawCursor = (x, y, brushSize, brushShape, brushColor) => {
|
const _drawCursor = (x, y, brushSize, brushShape, brushColor) => {
|
||||||
const canvas = cursorRef.current;
|
const canvas = cursorRef.current;
|
||||||
if (canvas) {
|
if (canvas != null) {
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
@ -146,7 +146,7 @@ export default function DrawImage({
|
|||||||
// function for external use
|
// function for external use
|
||||||
const fillCanvas = () => {
|
const fillCanvas = () => {
|
||||||
const canvas = drawingRef.current;
|
const canvas = drawingRef.current;
|
||||||
if (canvas) {
|
if (canvas != null) {
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
ctx.fillStyle = brushColor;
|
ctx.fillStyle = brushColor;
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
@ -4,15 +4,15 @@ import { ImageRequest, useImageCreate } from "../../../stores/imageCreateStore";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
generatedImageMain,
|
generatedImageMain,
|
||||||
image, //@ts-ignore
|
image, // @ts-expect-error
|
||||||
} from "./generatedImage.css.ts";
|
} from "./generatedImage.css.ts";
|
||||||
|
|
||||||
type GeneretaedImageProps = {
|
interface GeneretaedImageProps {
|
||||||
imageData: string;
|
imageData: string;
|
||||||
metadata: ImageRequest;
|
metadata: ImageRequest;
|
||||||
className?: string;
|
className?: string;
|
||||||
// children: never[];
|
// children: never[];
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function GeneratedImage({
|
export default function GeneratedImage({
|
||||||
imageData,
|
imageData,
|
||||||
|
@ -4,7 +4,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
|||||||
import { useCreateUI } from "../../creationPanelUIStore";
|
import { useCreateUI } from "../../creationPanelUIStore";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MenuButton, //@ts-ignore
|
MenuButton, // @ts-expect-error
|
||||||
} from "../advancedsettings.css.ts";
|
} from "../advancedsettings.css.ts";
|
||||||
|
|
||||||
export default function GpuSettings() {
|
export default function GpuSettings() {
|
||||||
|
@ -4,7 +4,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
|||||||
import { useCreateUI } from "../../creationPanelUIStore";
|
import { useCreateUI } from "../../creationPanelUIStore";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MenuButton, //@ts-ignore
|
MenuButton, // @ts-expect-error
|
||||||
} from "../advancedsettings.css.ts";
|
} from "../advancedsettings.css.ts";
|
||||||
|
|
||||||
export default function ImprovementSettings() {
|
export default function ImprovementSettings() {
|
||||||
|
@ -3,7 +3,7 @@ import { useCreateUI } from "../creationPanelUIStore";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
AdvancedSettingsList,
|
AdvancedSettingsList,
|
||||||
AdvancedSettingItem, // @ts-ignore
|
AdvancedSettingItem, // @ts-expect-error
|
||||||
} from "./advancedsettings.css.ts";
|
} from "./advancedsettings.css.ts";
|
||||||
|
|
||||||
import ImprovementSettings from "./improvementSettings";
|
import ImprovementSettings from "./improvementSettings";
|
||||||
|
@ -3,7 +3,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
|||||||
import { useCreateUI } from "../../creationPanelUIStore";
|
import { useCreateUI } from "../../creationPanelUIStore";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MenuButton, //@ts-ignore
|
MenuButton, // @ts-expect-error
|
||||||
} from "../advancedsettings.css.ts";
|
} from "../advancedsettings.css.ts";
|
||||||
// todo: move this someplace more global
|
// todo: move this someplace more global
|
||||||
const IMAGE_DIMENSIONS = [
|
const IMAGE_DIMENSIONS = [
|
||||||
|
@ -4,7 +4,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
|||||||
import { useCreateUI } from "../../creationPanelUIStore";
|
import { useCreateUI } from "../../creationPanelUIStore";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MenuButton, //@ts-ignore
|
MenuButton, // @ts-expect-error
|
||||||
} from "../advancedsettings.css.ts";
|
} from "../advancedsettings.css.ts";
|
||||||
|
|
||||||
export default function WorkflowSettings() {
|
export default function WorkflowSettings() {
|
||||||
|
@ -3,7 +3,7 @@ import { useImageCreate } from "../../../../stores/imageCreateStore";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
CreationBasicMain,
|
CreationBasicMain,
|
||||||
PromptDisplay, // @ts-ignore
|
PromptDisplay, // @ts-expect-error
|
||||||
} from "./basicCreation.css.ts";
|
} from "./basicCreation.css.ts";
|
||||||
|
|
||||||
import SeedImage from "./seedImage";
|
import SeedImage from "./seedImage";
|
||||||
|
@ -7,7 +7,7 @@ import { v4 as uuidv4 } from "uuid";
|
|||||||
import { useRandomSeed } from "../../../../../utils";
|
import { useRandomSeed } from "../../../../../utils";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MakeButtonStyle, // @ts-ignore
|
MakeButtonStyle, // @ts-expect-error
|
||||||
} from "./makeButton.css.ts";
|
} from "./makeButton.css.ts";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@ -65,7 +65,7 @@ export default function MakeButton() {
|
|||||||
// updated the number of images to make
|
// updated the number of images to make
|
||||||
num_outputs: num,
|
num_outputs: num,
|
||||||
// update the seed
|
// update the seed
|
||||||
seed: seed,
|
seed,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
ImageInput,
|
ImageInput,
|
||||||
ImageInputButton,
|
ImageInputButton,
|
||||||
ImageFixer,
|
ImageFixer,
|
||||||
XButton, // @ts-ignore
|
XButton, // @ts-expect-error
|
||||||
} from "./seedImage.css.ts";
|
} from "./seedImage.css.ts";
|
||||||
import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
import { useImageCreate } from "../../../../../stores/imageCreateStore";
|
||||||
|
|
||||||
@ -27,13 +27,13 @@ export default function SeedImage(_props: any) {
|
|||||||
imageInputRef.current?.click();
|
imageInputRef.current?.click();
|
||||||
};
|
};
|
||||||
const _handleFileSelect = (event: ChangeEvent<HTMLInputElement>) => {
|
const _handleFileSelect = (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
//@ts-ignore
|
// @ts-expect-error
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
if (e.target) {
|
if (e.target != null) {
|
||||||
setRequestOption("init_image", e.target.result);
|
setRequestOption("init_image", e.target.result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import create from "zustand";
|
import create from "zustand";
|
||||||
import produce from "immer";
|
import produce from "immer";
|
||||||
import { persist } from "zustand/middleware";
|
import { persist, devtools } from "zustand/middleware";
|
||||||
import { devtools } from "zustand/middleware";
|
|
||||||
|
|
||||||
export type ImageCreationUIOptions = {
|
export type ImageCreationUIOptions = {
|
||||||
isOpenAdvancedSettings: boolean;
|
isOpenAdvancedSettings: boolean;
|
||||||
|
@ -8,9 +8,9 @@ import { useCreateUI } from "../creationPanelUIStore";
|
|||||||
|
|
||||||
import ModifierTag from "../../../atoms/modifierTag";
|
import ModifierTag from "../../../atoms/modifierTag";
|
||||||
|
|
||||||
type ModifierListProps = {
|
interface ModifierListProps {
|
||||||
tags: string[];
|
tags: string[];
|
||||||
};
|
}
|
||||||
|
|
||||||
function ModifierList({ tags }: ModifierListProps) {
|
function ModifierList({ tags }: ModifierListProps) {
|
||||||
return (
|
return (
|
||||||
@ -24,10 +24,10 @@ function ModifierList({ tags }: ModifierListProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
type ModifierGroupingProps = {
|
interface ModifierGroupingProps {
|
||||||
title: string;
|
title: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
};
|
}
|
||||||
|
|
||||||
function ModifierGrouping({ title, tags }: ModifierGroupingProps) {
|
function ModifierGrouping({ title, tags }: ModifierGroupingProps) {
|
||||||
// doing this localy for now, but could move to a store
|
// doing this localy for now, but could move to a store
|
||||||
|
@ -13,7 +13,7 @@ import "./creationPanel.css";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
CreationPaneMain,
|
CreationPaneMain,
|
||||||
InpaintingSlider, // @ts-ignore
|
InpaintingSlider, // @ts-expect-error
|
||||||
} from "./creationpane.css.ts";
|
} from "./creationpane.css.ts";
|
||||||
|
|
||||||
import BasicCreation from "./basicCreation";
|
import BasicCreation from "./basicCreation";
|
||||||
|
@ -6,7 +6,7 @@ import { useImageCreate } from "../../../../stores/imageCreateStore";
|
|||||||
import {
|
import {
|
||||||
InpaintingPanelMain,
|
InpaintingPanelMain,
|
||||||
InpaintingControls,
|
InpaintingControls,
|
||||||
InpaintingControlRow, // @ts-ignore
|
InpaintingControlRow, // @ts-expect-error
|
||||||
} from "./inpaintingPanel.css.ts";
|
} from "./inpaintingPanel.css.ts";
|
||||||
|
|
||||||
export default function InpaintingPanel() {
|
export default function InpaintingPanel() {
|
||||||
|
@ -4,7 +4,7 @@ import { API_URL } from "../../../../api";
|
|||||||
const url = `${API_URL}/ding.mp3`;
|
const url = `${API_URL}/ding.mp3`;
|
||||||
|
|
||||||
const AudioDing = React.forwardRef((props, ref) => (
|
const AudioDing = React.forwardRef((props, ref) => (
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
<audio ref={ref} style={{ display: "none" }}>
|
<audio ref={ref} style={{ display: "none" }}>
|
||||||
<source src={url} type="audio/mp3" />
|
<source src={url} type="audio/mp3" />
|
||||||
</audio>
|
</audio>
|
||||||
|
@ -2,16 +2,16 @@ import React from "react";
|
|||||||
|
|
||||||
import { CompletedImagesType } from "../index";
|
import { CompletedImagesType } from "../index";
|
||||||
|
|
||||||
type CurrentDisplayProps = {
|
|
||||||
images: CompletedImagesType[] | null;
|
|
||||||
setCurrentDisplay: (image: CompletedImagesType) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
completedImagesMain,
|
completedImagesMain,
|
||||||
imageContain, //@ts-ignore
|
imageContain, // @ts-expect-error
|
||||||
} from "./completedImages.css.ts";
|
} from "./completedImages.css.ts";
|
||||||
|
|
||||||
|
interface CurrentDisplayProps {
|
||||||
|
images: CompletedImagesType[] | null;
|
||||||
|
setCurrentDisplay: (image: CompletedImagesType) => void;
|
||||||
|
}
|
||||||
|
|
||||||
export default function CompletedImages({
|
export default function CompletedImages({
|
||||||
images,
|
images,
|
||||||
setCurrentDisplay,
|
setCurrentDisplay,
|
||||||
@ -23,7 +23,7 @@ export default function CompletedImages({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={completedImagesMain}>
|
<div className={completedImagesMain}>
|
||||||
{images &&
|
{images != null &&
|
||||||
images.map((image, index) => {
|
images.map((image, index) => {
|
||||||
if (void 0 === image) {
|
if (void 0 === image) {
|
||||||
console.warn(`image ${index} is undefined`);
|
console.warn(`image ${index} is undefined`);
|
||||||
|
@ -7,12 +7,13 @@ import {
|
|||||||
|
|
||||||
import { CompletedImagesType } from "../index";
|
import { CompletedImagesType } from "../index";
|
||||||
|
|
||||||
type CurrentDisplayProps = {
|
interface CurrentDisplayProps {
|
||||||
image: CompletedImagesType | null;
|
image: CompletedImagesType | null;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
||||||
const { info, data } = image || { info: null, data: null };
|
// @ts-ignore
|
||||||
|
const { info, data } = image != null || { info: null, data: null };
|
||||||
|
|
||||||
const setRequestOption = useImageCreate((state) => state.setRequestOptions);
|
const setRequestOption = useImageCreate((state) => state.setRequestOptions);
|
||||||
|
|
||||||
@ -26,9 +27,9 @@ export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
|||||||
use_upscale,
|
use_upscale,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
} = info!;
|
} = info;
|
||||||
|
|
||||||
//Most important information is the prompt
|
// Most important information is the prompt
|
||||||
let underscoreName = prompt.replace(/[^a-zA-Z0-9]/g, "_");
|
let underscoreName = prompt.replace(/[^a-zA-Z0-9]/g, "_");
|
||||||
underscoreName = underscoreName.substring(0, 100);
|
underscoreName = underscoreName.substring(0, 100);
|
||||||
// name and the top level metadata
|
// name and the top level metadata
|
||||||
@ -43,7 +44,7 @@ export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
|||||||
// Add the width and height
|
// Add the width and height
|
||||||
fileName += `_${width}x${height}`;
|
fileName += `_${width}x${height}`;
|
||||||
// add the file extension
|
// add the file extension
|
||||||
fileName += `.png`;
|
fileName += ".png";
|
||||||
// return fileName
|
// return fileName
|
||||||
return fileName;
|
return fileName;
|
||||||
};
|
};
|
||||||
@ -61,10 +62,10 @@ export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="current-display">
|
<div className="current-display">
|
||||||
{image && (
|
{image != null && (
|
||||||
<div>
|
<div>
|
||||||
<p> {info!.prompt}</p>
|
<p> {info.prompt}</p>
|
||||||
<GeneratedImage imageData={data!} metadata={info!}></GeneratedImage>
|
<GeneratedImage imageData={data} metadata={info}></GeneratedImage>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button onClick={_handleSave}>Save</button>
|
<button onClick={_handleSave}>Save</button>
|
||||||
|
@ -20,19 +20,19 @@ import {
|
|||||||
displayContainer,
|
displayContainer,
|
||||||
// CurrentDisplay,
|
// CurrentDisplay,
|
||||||
previousImages,
|
previousImages,
|
||||||
previousImage, //@ts-ignore
|
previousImage, // @ts-expect-error
|
||||||
} from "./displayPanel.css.ts";
|
} from "./displayPanel.css.ts";
|
||||||
|
|
||||||
export type CompletedImagesType = {
|
export interface CompletedImagesType {
|
||||||
id: string;
|
id: string;
|
||||||
data: string;
|
data: string;
|
||||||
info: ImageRequest;
|
info: ImageRequest;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function DisplayPanel() {
|
export default function DisplayPanel() {
|
||||||
const dingRef = useRef<HTMLAudioElement>(null);
|
const dingRef = useRef<HTMLAudioElement>(null);
|
||||||
const isSoundEnabled = useImageCreate((state) => state.isSoundEnabled());
|
const isSoundEnabled = useImageCreate((state) => state.isSoundEnabled());
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const { id, options } = useImageQueue((state) => state.firstInQueue());
|
const { id, options } = useImageQueue((state) => state.firstInQueue());
|
||||||
const removeFirstInQueue = useImageQueue((state) => state.removeFirstInQueue);
|
const removeFirstInQueue = useImageQueue((state) => state.removeFirstInQueue);
|
||||||
const [currentImage, setCurrentImage] = useState<CompletedImagesType | null>(
|
const [currentImage, setCurrentImage] = useState<CompletedImagesType | null>(
|
||||||
@ -41,7 +41,7 @@ export default function DisplayPanel() {
|
|||||||
|
|
||||||
const { status, data } = useQuery(
|
const { status, data } = useQuery(
|
||||||
[MakeImageKey, id],
|
[MakeImageKey, id],
|
||||||
() => doMakeImage(options),
|
async () => await doMakeImage(options),
|
||||||
{
|
{
|
||||||
enabled: void 0 !== id,
|
enabled: void 0 !== id,
|
||||||
}
|
}
|
||||||
@ -84,13 +84,13 @@ export default function DisplayPanel() {
|
|||||||
const temp = completedQueries
|
const temp = completedQueries
|
||||||
.map((query, index) => {
|
.map((query, index) => {
|
||||||
if (void 0 !== query) {
|
if (void 0 !== query) {
|
||||||
//@ts-ignore
|
// @ts-ignore
|
||||||
return query.output.map((data) => {
|
return query.output.map((data) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return {
|
return {
|
||||||
id: `${completedIds[index]}-${data.seed}`,
|
id: `${completedIds[index]}-${data.seed}`,
|
||||||
data: data.data,
|
data: data.data,
|
||||||
//@ts-ignore
|
// @ts-ignore
|
||||||
info: { ...query.request, seed: data.seed },
|
info: { ...query.request, seed: data.seed },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,11 @@ export default function FooterDisplay() {
|
|||||||
<div id="footer" className="panel-box">
|
<div id="footer" className="panel-box">
|
||||||
<p>
|
<p>
|
||||||
If you found this project useful and want to help keep it alive, please{" "}
|
If you found this project useful and want to help keep it alive, please{" "}
|
||||||
<a href="https://ko-fi.com/cmdr2_stablediffusion_ui" target="_blank">
|
<a
|
||||||
|
href="https://ko-fi.com/cmdr2_stablediffusion_ui"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
<img src={`${API_URL}/kofi.png`} id="coffeeButton" />
|
<img src={`${API_URL}/kofi.png`} id="coffeeButton" />
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
to help cover the cost of development and maintenance! Thank you for
|
to help cover the cost of development and maintenance! Thank you for
|
||||||
@ -17,13 +21,18 @@ export default function FooterDisplay() {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Please feel free to join the{" "}
|
Please feel free to join the{" "}
|
||||||
<a href="https://discord.com/invite/u9yhsFmEkB" target="_blank">
|
<a
|
||||||
|
href="https://discord.com/invite/u9yhsFmEkB"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
discord community
|
discord community
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
or{" "}
|
or{" "}
|
||||||
<a
|
<a
|
||||||
href="https://github.com/cmdr2/stable-diffusion-ui/issues"
|
href="https://github.com/cmdr2/stable-diffusion-ui/issues"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
file an issue
|
file an issue
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
@ -43,6 +52,7 @@ export default function FooterDisplay() {
|
|||||||
<a
|
<a
|
||||||
href="https://github.com/cmdr2/stable-diffusion-ui/blob/main/LICENSE"
|
href="https://github.com/cmdr2/stable-diffusion-ui/blob/main/LICENSE"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
the license
|
the license
|
||||||
</a>
|
</a>
|
||||||
|
@ -5,10 +5,10 @@ import { KEY_CONFIG, getConfig } from "../../../api";
|
|||||||
|
|
||||||
import StatusDisplay from "./statusDisplay";
|
import StatusDisplay from "./statusDisplay";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HeaderDisplayMain, //@ts-ignore
|
HeaderDisplayMain, // @ts-expect-error
|
||||||
} from "./headerDisplay.css.ts";
|
} from "./headerDisplay.css.ts";
|
||||||
|
|
||||||
export default function HeaderDisplay() {
|
export default function HeaderDisplay() {
|
||||||
|
@ -3,16 +3,16 @@ import { useQuery } from "@tanstack/react-query";
|
|||||||
|
|
||||||
import { healthPing, HEALTH_PING_INTERVAL } from "../../../../api";
|
import { healthPing, HEALTH_PING_INTERVAL } from "../../../../api";
|
||||||
|
|
||||||
const startingMessage = "Stable Diffusion is starting...";
|
|
||||||
const successMessage = "Stable Diffusion is ready to use!";
|
|
||||||
const errorMessage = "Stable Diffusion is not running!";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
StartingStatus,
|
StartingStatus,
|
||||||
ErrorStatus,
|
ErrorStatus,
|
||||||
SuccessStatus,
|
SuccessStatus,
|
||||||
} from "./statusDisplay.css";
|
} from "./statusDisplay.css";
|
||||||
|
|
||||||
|
const startingMessage = "Stable Diffusion is starting...";
|
||||||
|
const successMessage = "Stable Diffusion is ready to use!";
|
||||||
|
const errorMessage = "Stable Diffusion is not running!";
|
||||||
|
|
||||||
export default function StatusDisplay({ className }: { className?: string }) {
|
export default function StatusDisplay({ className }: { className?: string }) {
|
||||||
const [statusMessage, setStatusMessage] = useState(startingMessage);
|
const [statusMessage, setStatusMessage] = useState(startingMessage);
|
||||||
const [statusClass, setStatusClass] = useState(StartingStatus);
|
const [statusClass, setStatusClass] = useState(StartingStatus);
|
||||||
@ -42,7 +42,7 @@ export default function StatusDisplay({ className }: { className?: string }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* alittle hacky but joins the class names, will probably need a better css in js solution or tailwinds*/}
|
{/* alittle hacky but joins the class names, will probably need a better css in js solution or tailwinds */}
|
||||||
<p className={[statusClass, className].join(" ")}>{statusMessage}</p>
|
<p className={[statusClass, className].join(" ")}>{statusMessage}</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
HeaderLayout,
|
HeaderLayout,
|
||||||
CreateLayout,
|
CreateLayout,
|
||||||
DisplayLayout,
|
DisplayLayout,
|
||||||
FooterLayout, // @ts-ignore
|
FooterLayout, // @ts-expect-error
|
||||||
} from "./home.css.ts";
|
} from "./home.css.ts";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@ -45,7 +45,7 @@ function Home({ className }: { className: any }) {
|
|||||||
if (statusMods === "success") {
|
if (statusMods === "success") {
|
||||||
setAllModifiers(dataMoads);
|
setAllModifiers(dataMoads);
|
||||||
} else if (statusMods === "error") {
|
} else if (statusMods === "error") {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
setAllModifiers(Mockifiers);
|
setAllModifiers(Mockifiers);
|
||||||
}
|
}
|
||||||
}, [setRequestOption, statusMods, dataMoads]);
|
}, [setRequestOption, statusMods, dataMoads]);
|
||||||
|
@ -250,7 +250,7 @@ export const useImageCreate = create<ImageCreateState>(
|
|||||||
},
|
},
|
||||||
|
|
||||||
isUsingUpscaling: () => {
|
isUsingUpscaling: () => {
|
||||||
const isUsing = get().getValueForRequestKey("use_upscale") != "";
|
const isUsing = get().getValueForRequestKey("use_upscale") !== "";
|
||||||
return isUsing;
|
return isUsing;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import eslint from "vite-plugin-eslint";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
|
eslint(),
|
||||||
react(),
|
react(),
|
||||||
vanillaExtractPlugin({
|
vanillaExtractPlugin({
|
||||||
// configuration
|
// configuration
|
||||||
|
4
ui/frontend/dist/index.js
vendored
4
ui/frontend/dist/index.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user