clean and pretty

This commit is contained in:
caranicas 2022-09-19 15:40:34 -04:00
parent 82f8c31b81
commit 1ac8eba1b8
33 changed files with 115 additions and 127 deletions

View File

@ -59,7 +59,6 @@ export const toggleBetaConfig = async (branch: string) => {
export const MakeImageKey = "MakeImage"; export const MakeImageKey = "MakeImage";
export const doMakeImage = async (reqBody: ImageRequest) => { export const doMakeImage = async (reqBody: ImageRequest) => {
const res = await fetch(`${API_URL}/image`, { const res = await fetch(`${API_URL}/image`, {
method: "POST", method: "POST",
headers: { headers: {

View File

@ -4,10 +4,9 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
import { useCreateUI } from "../../creationPanelUIStore"; import { useCreateUI } from "../../creationPanelUIStore";
import { import {
SettingItem // @ts-expect-error SettingItem, // @ts-expect-error
} from "../../../../../styles/shared.css.ts"; } from "../../../../../styles/shared.css.ts";
import { import {
MenuButton, // @ts-expect-error MenuButton, // @ts-expect-error
} from "../advancedsettings.css.ts"; } from "../advancedsettings.css.ts";

View File

@ -4,7 +4,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
import { useCreateUI } from "../../creationPanelUIStore"; import { useCreateUI } from "../../creationPanelUIStore";
import { import {
SettingItem // @ts-expect-error SettingItem, // @ts-expect-error
} from "../../../../../styles/shared.css.ts"; } from "../../../../../styles/shared.css.ts";
import { import {
MenuButton, // @ts-expect-error MenuButton, // @ts-expect-error
@ -43,7 +43,6 @@ export default function ImprovementSettings() {
const [isFilteringDisabled, setIsFilteringDisabled] = useState(false); const [isFilteringDisabled, setIsFilteringDisabled] = useState(false);
// should probably be a store selector // should probably be a store selector
useEffect(() => { useEffect(() => {
// if either are true we arent disabled // if either are true we arent disabled
if (isUsingFaceCorrection || useUpscale) { if (isUsingFaceCorrection || useUpscale) {
setIsFilteringDisabled(false); setIsFilteringDisabled(false);

View File

@ -3,7 +3,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
import { useCreateUI } from "../../creationPanelUIStore"; import { useCreateUI } from "../../creationPanelUIStore";
import { import {
SettingItem // @ts-expect-error SettingItem, // @ts-expect-error
} from "../../../../../styles/shared.css.ts"; } from "../../../../../styles/shared.css.ts";
import { import {

View File

@ -4,7 +4,7 @@ import { useImageCreate } from "../../../../../stores/imageCreateStore";
import { useCreateUI } from "../../creationPanelUIStore"; import { useCreateUI } from "../../creationPanelUIStore";
import { import {
SettingItem // @ts-expect-error SettingItem, // @ts-expect-error
} from "../../../../../styles/shared.css.ts"; } from "../../../../../styles/shared.css.ts";
import { import {

View File

@ -10,9 +10,8 @@ import {
ImagerModifierGroups, ImagerModifierGroups,
ImageModifierGrouping, ImageModifierGrouping,
MenuButton, MenuButton,
ModifierListStyle ModifierListStyle, //@ts-expect-error
} from //@ts-expect-error } from "./imageModifiers.css.ts";
"./imageModifiers.css.ts";
import { useImageCreate } from "../../../../stores/imageCreateStore"; import { useImageCreate } from "../../../../stores/imageCreateStore";
import { useCreateUI } from "../creationPanelUIStore"; import { useCreateUI } from "../creationPanelUIStore";

View File

@ -74,7 +74,6 @@ const app = createGlobalTheme(":root", {
Body: "1em", Body: "1em",
Caption: ".75em", Caption: ".75em",
Overline: ".5em", Overline: ".5em",
}, },
}, },
colors: colors, colors: colors,
@ -113,7 +112,7 @@ export const darkTheme = createTheme(colors, {
accentDimmed: "#7d6641", // muted orange accentDimmed: "#7d6641", // muted orange
}, },
link: '#0066cc', // blue link: "#0066cc", // blue
warning: "#f0ad4e", warning: "#f0ad4e",
error: "#d9534f", error: "#d9534f",
success: "#5cb85c", success: "#5cb85c",
@ -152,7 +151,7 @@ export const lightTheme = createTheme(colors, {
accentDimmed: "#6B7280", accentDimmed: "#6B7280",
}, },
link: '#0066cc', // blue link: "#0066cc", // blue
warning: "yellow", warning: "yellow",
error: "red", error: "red",
success: "green", success: "green",

View File

@ -18,11 +18,9 @@ export const completedImagesList = style({
width: "100%", width: "100%",
overflow: "auto", overflow: "auto",
paddingLeft: vars.spacing.none, paddingLeft: vars.spacing.none,
}); });
globalStyle(`${completedImagesMain} li`, { globalStyle(`${completedImagesMain} li`, {
position: "relative", position: "relative",
}); });
@ -34,7 +32,6 @@ globalStyle(`${completedImagesMain} > li:last-of-type`, {
marginRight: 0, marginRight: 0,
}); });
export const imageContain = style({ export const imageContain = style({
width: "206px", width: "206px",
backgroundColor: "black", backgroundColor: "black",
@ -48,8 +45,6 @@ export const imageContain = style({
cursor: "pointer", cursor: "pointer",
}); });
globalStyle(`${imageContain} img`, { globalStyle(`${imageContain} img`, {
width: "100%", width: "100%",
objectFit: "contain", objectFit: "contain",

View File

@ -30,11 +30,14 @@ export default function CompletedImages ({
<div className={completedImagesMain}> <div className={completedImagesMain}>
{/* Adjust the dom do we dont do this check twice */} {/* Adjust the dom do we dont do this check twice */}
{images != null && images.length > 0 && ( {images != null && images.length > 0 && (
<button className={RemoveButton} onClick={ <button
() => { className={RemoveButton}
onClick={() => {
removeImages(); removeImages();
} }}
}>REMOVE</button> >
REMOVE
</button>
)} )}
<ul className={completedImagesList}> <ul className={completedImagesList}>
{images != null && {images != null &&
@ -59,6 +62,5 @@ export default function CompletedImages ({
})} })}
</ul> </ul>
</div> </div>
); );
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable multiline-ternary */
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import React from "react"; import React from "react";
import GeneratedImage from "../../../molecules/generatedImage"; import GeneratedImage from "../../../molecules/generatedImage";
@ -13,7 +14,10 @@ interface CurrentDisplayProps {
image: CompletedImagesType | null; image: CompletedImagesType | null;
} }
export default function CurrentDisplay({ isLoading, image }: CurrentDisplayProps) { export default function CurrentDisplay({
isLoading,
image,
}: CurrentDisplayProps) {
const { info, data } = image ?? {}; const { info, data } = image ?? {};
const setRequestOption = useImageCreate((state) => state.setRequestOptions); const setRequestOption = useImageCreate((state) => state.setRequestOptions);
@ -30,7 +34,6 @@ export default function CurrentDisplay({ isLoading, image }: CurrentDisplayProps
height, height,
} = info! as ImageRequest; } = info! as ImageRequest;
// 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);
@ -62,12 +65,12 @@ export default function CurrentDisplay({ isLoading, image }: CurrentDisplayProps
setRequestOption("init_image", data); setRequestOption("init_image", data);
}; };
return ( return (
<div className="current-display"> <div className="current-display">
{isLoading {isLoading ? (
? <h4 className="loading">Loading...</h4> <h4 className="loading">Loading...</h4>
: (image != null && ( ) : (
(image != null && (
<div> <div>
<p> {info?.prompt}</p> <p> {info?.prompt}</p>
<GeneratedImage imageData={data} metadata={info}></GeneratedImage> <GeneratedImage imageData={data} metadata={info}></GeneratedImage>
@ -76,8 +79,8 @@ export default function CurrentDisplay({ isLoading, image }: CurrentDisplayProps
<button onClick={_handleUseAsInput}>Use as Input</button> <button onClick={_handleUseAsInput}>Use as Input</button>
</div> </div>
</div> </div>
)) || <h4 className="no-image">Try Making a new image!</h4>} )) || <h4 className="no-image">Try Making a new image!</h4>
)}
</div> </div>
); );
} }

View File

@ -29,7 +29,7 @@ export interface CompletedImagesType {
info: ImageRequest; info: ImageRequest;
} }
const idDelim = '_batch'; const idDelim = "_batch";
export default function DisplayPanel() { export default function DisplayPanel() {
const dingRef = useRef<HTMLAudioElement>(null); const dingRef = useRef<HTMLAudioElement>(null);
@ -51,14 +51,14 @@ export default function DisplayPanel() {
[MakeImageKey, id], [MakeImageKey, id],
async () => await doMakeImage(options), async () => await doMakeImage(options),
{ {
enabled: isEnabled enabled: isEnabled,
// void 0 !== id, // void 0 !== id,
} }
); );
// update the enabled state when the id changes // update the enabled state when the id changes
useEffect(() => { useEffect(() => {
setIsEnabled(void 0 !== id) setIsEnabled(void 0 !== id);
}, [id]); }, [id]);
// helper for the loading state to be enabled aware // helper for the loading state to be enabled aware
@ -84,7 +84,6 @@ export default function DisplayPanel() {
} }
}, [status, data, removeFirstInQueue, dingRef, isSoundEnabled]); }, [status, data, removeFirstInQueue, dingRef, isSoundEnabled]);
/* COMPLETED IMAGES */ /* COMPLETED IMAGES */
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const [completedImages, setCompletedImages] = useState<CompletedImagesType[]>( const [completedImages, setCompletedImages] = useState<CompletedImagesType[]>(
@ -140,13 +139,14 @@ export default function DisplayPanel() {
clearCachedIds(); clearCachedIds();
}; };
return ( return (
<div className={displayPanel}> <div className={displayPanel}>
<AudioDing ref={dingRef}></AudioDing> <AudioDing ref={dingRef}></AudioDing>
<div className={displayContainer}> <div className={displayContainer}>
<CurrentDisplay isLoading={isLoading} image={currentImage}></CurrentDisplay> <CurrentDisplay
isLoading={isLoading}
image={currentImage}
></CurrentDisplay>
</div> </div>
<div className={previousImages}> <div className={previousImages}>
<CompletedImages <CompletedImages

View File

@ -3,7 +3,6 @@ import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-ignore
import { vars } from "../../../styles/theme/index.css.ts"; import { vars } from "../../../styles/theme/index.css.ts";
export const FooterDisplayMain = style({ export const FooterDisplayMain = style({
color: vars.colors.text.normal, color: vars.colors.text.normal,
fontSize: vars.fonts.sizes.Caption, fontSize: vars.fonts.sizes.Caption,
@ -13,7 +12,8 @@ export const FooterDisplayMain = style({
// marginBottom: vars.spacing.medium, // marginBottom: vars.spacing.medium,
// TODO move this to the theme // TODO move this to the theme
padding: vars.spacing.small, padding: vars.spacing.small,
boxShadow: "0 4px 8px 0 rgba(0, 0, 0, 0.15), 0 6px 20px 0 rgba(0, 0, 0, 0.15)", boxShadow:
"0 4px 8px 0 rgba(0, 0, 0, 0.15), 0 6px 20px 0 rgba(0, 0, 0, 0.15)",
}); });
export const CoffeeButton = style({ export const CoffeeButton = style({
@ -46,7 +46,6 @@ globalStyle(`${FooterDisplayMain} p`, {
margin: vars.spacing.min, margin: vars.spacing.min,
}); });
// .footer-display { // .footer-display {
// color: #ffffff; // color: #ffffff;
// display: flex; // display: flex;

View File

@ -2,9 +2,8 @@ import React from "react";
import { import {
FooterDisplayMain, FooterDisplayMain,
CoffeeButton CoffeeButton, // @ts-ignore
} from // @ts-ignore } from "./footerDisplay.css.ts";
"./footerDisplay.css.ts";
import { API_URL } from "../../../api"; import { API_URL } from "../../../api";

View File

@ -53,6 +53,5 @@ export const useImageQueue = create<ImageQueueState>((set, get) => ({
state.completedImageIds = []; state.completedImageIds = [];
}) })
); );
} },
})); }));

View File

@ -26,7 +26,7 @@ globalStyle(`*`, {
globalStyle(`button`, { globalStyle(`button`, {
fontSize: vars.fonts.sizes.Body, fontSize: vars.fonts.sizes.Body,
}) });
/** RESETS */ /** RESETS */
globalStyle(`p, h1, h2, h3, h4, h5, h6, ul`, { globalStyle(`p, h1, h2, h3, h4, h5, h6, ul`, {
@ -41,7 +41,6 @@ globalStyle(`h3`, {
globalStyle(`h4, h5`, { globalStyle(`h4, h5`, {
fontSize: vars.fonts.sizes.SubSubheadline, fontSize: vars.fonts.sizes.SubSubheadline,
fontFamily: vars.fonts.body, fontFamily: vars.fonts.body,
}); });
globalStyle(`p, label`, { globalStyle(`p, label`, {
@ -54,6 +53,6 @@ globalStyle(`textarea`, {
padding: 0, padding: 0,
border: "none", border: "none",
fontSize: vars.fonts.sizes.Body, fontSize: vars.fonts.sizes.Body,
fontWeight: 'bold', fontWeight: "bold",
fontFamily: vars.fonts.body, fontFamily: vars.fonts.body,
}); });

View File

@ -9,11 +9,10 @@ export const PanelBox = style({
borderRadius: vars.trim.smallBorderRadius, borderRadius: vars.trim.smallBorderRadius,
marginBottom: vars.spacing.medium, marginBottom: vars.spacing.medium,
// TODO move this to the theme // TODO move this to the theme
boxShadow: "0 4px 8px 0 rgba(0, 0, 0, 0.15), 0 6px 20px 0 rgba(0, 0, 0, 0.15)", boxShadow:
"0 4px 8px 0 rgba(0, 0, 0, 0.15), 0 6px 20px 0 rgba(0, 0, 0, 0.15)",
}); });
globalStyle(`${PanelBox} .panel-box-toggle-btn`, { globalStyle(`${PanelBox} .panel-box-toggle-btn`, {
display: "block", display: "block",
width: "100%", width: "100%",

View File

@ -12,7 +12,6 @@ import {
* Lots of these arent used yet, but once they are defined and useable then they can be set. * Lots of these arent used yet, but once they are defined and useable then they can be set.
*/ */
const colors = createThemeContract({ const colors = createThemeContract({
brand: null, brand: null,
brandDimmed: null, brandDimmed: null,
@ -55,7 +54,7 @@ const colors = createThemeContract({
const app = createGlobalTheme(":root", { const app = createGlobalTheme(":root", {
spacing: { spacing: {
none: "0", none: "0",
min: '2px', min: "2px",
small: "5px", small: "5px",
medium: "10px", medium: "10px",
large: "25px", large: "25px",
@ -76,7 +75,6 @@ const app = createGlobalTheme(":root", {
Plain: "0.8em", Plain: "0.8em",
Caption: ".75em", Caption: ".75em",
Overline: ".5em", Overline: ".5em",
}, },
}, },
colors, colors,
@ -115,7 +113,7 @@ export const darkTheme = createTheme(colors, {
accentDimmed: "#7d6641", // muted orange accentDimmed: "#7d6641", // muted orange
}, },
link: '#0066cc', // blue link: "#0066cc", // blue
warning: "#f0ad4e", warning: "#f0ad4e",
error: "#d9534f", error: "#d9534f",
success: "#5cb85c", success: "#5cb85c",
@ -154,7 +152,7 @@ export const lightTheme = createTheme(colors, {
accentDimmed: "#6B7280", accentDimmed: "#6B7280",
}, },
link: '#0066cc', // blue link: "#0066cc", // blue
warning: "yellow", warning: "yellow",
error: "red", error: "red",
success: "green", success: "green",

View File

@ -1,9 +1,9 @@
import { defineConfig } from 'vite'; import { defineConfig } from "vite";
import eslint from 'vite-plugin-eslint'; 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";
import path from 'path'; import path from "path";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
resolve: { resolve: {

File diff suppressed because one or more lines are too long