Skip to content

Commit

Permalink
fix styling assumptions and optimize sentry plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nyakase committed Sep 8, 2024
1 parent 1207503 commit 61e88fc
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 25 deletions.
4 changes: 2 additions & 2 deletions desktop/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { dirname } from 'path';
import { fileURLToPath } from 'url';
import os from "node:os";
import * as path from "node:path";
import installExtension, {REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS} from "@tomjs/electron-devtools-installer";
import installExtension, {REACT_DEVELOPER_TOOLS} from "@tomjs/electron-devtools-installer";
const __dirname = fileURLToPath(dirname(import.meta.url));
const gamePLUS = new Worker(path.join(__dirname, 'gameplus.js'));

Expand Down Expand Up @@ -57,7 +57,7 @@ const createWindow = () => {
autoUpdater.checkForUpdates();
}, 60000)
} else {
installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS])
installExtension([REACT_DEVELOPER_TOOLS])
}

win.loadURL(
Expand Down
5 changes: 0 additions & 5 deletions src/components/_services/lightquark/nav/Aviebox.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import styles from './Aviebox.module.css';
import {useContext} from "react";
import {AppContext} from "../../../../contexts/AppContext.js";
import ProfilePicture from "../../../dialogs/ProfilePicture.jsx";
import localForage from "localforage";
import {useNavigate} from "react-router-dom";
import NiceModal from "@ebay/nice-modal-react";
import JoinQuarkModal from "../../../modals/JoinQuarkModal.jsx";
import SettingsView from "../../../../routes/SettingsView.jsx";
import UserSettingsSidebar from "../../../nav/UserSettingsSidebar.jsx";
import UserSettingsArea from "../../../nav/UserSettingsArea.jsx";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {useContext, useEffect, useState} from "react";
import LQ from "../../../../util/LQ.js";
import {useParams} from "react-router-dom";
import LightquarkChannel from "./LightquarkChannel.jsx";
import styles from "./LightquarkChannelList.module.css";
import {AppContext} from "../../../../contexts/AppContext.js";

export default function LightquarkChannelList({quark, demo}) {
return <div className={styles.channelList}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.channelList {
background: var(--background-color-less)

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
justify-content: space-between;

padding: 0.5em;
background-color: var(--background-color-less);
border-bottom: 2px dashed var(--background-color-min);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function SettingsID({quarkId}) {

return <div className={styles.userInfoWrap}>
<div onClick={uploadPicture} className={styles.profilePictureWrap}>
<NyafileImage src={"img/upload"} inlinesvg="true"
<NyafileImage src={"img/upload"} inlinesvg={"true"}
className={classnames(styles.uploadIcon, {[styles.uploading]: isUploading})}/>
<ProfilePicture src={targetAvatar} px={80} doPurr={false}/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/nav/UserSettingsSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default function UserSettingsSidebar({area, setArea}) {
<NyafileImage src={"img/nineball"} className={styles.nineplus}/>
</div>
<div className={styles.sns}>
<a href={"https://twitter.com/nineplus_sh"} target={"_blank"} rel="noreferrer"><NyafileImage src={"img/twitter"} inlinesvg="true"/></a>
<a href={"https://tumblr.com/nineplus-sh"} target={"_blank"} rel="noreferrer"><NyafileImage src={"img/tumblr"} inlinesvg="true"/></a>
<a href={"https://twitter.com/nineplus_sh"} target={"_blank"} rel="noreferrer"><NyafileImage src={"img/twitter"} inlinesvg={"true"}/></a>
<a href={"https://tumblr.com/nineplus-sh"} target={"_blank"} rel="noreferrer"><NyafileImage src={"img/tumblr"} inlinesvg={"true"}/></a>
</div>
</div>
}
14 changes: 7 additions & 7 deletions src/components/nyafile/NyafileImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ import {AppContext} from "../../contexts/AppContext.js";
/**
* A wrapper for <img> that allows specifying a Nyafile path in the src instead.
* TODO: Fix this. Not ported. Bad.
* @param src - The path to the image in the Nyafile.
* @param props - The props of the component to pass down to the <img>, provided by React.
* @returns {JSX.Element} - The <img> tag with the image from the Nyafile as the src.
* @constructor
*/
export default function NyafileImage(props) {
export default function NyafileImage({src, inlinesvg, ...props}) {
let appContext = useContext(AppContext);
const { src, ...otherProps } = props;
const [image, setImage] = useState("");
const [svg, setSvg] = useState(null);

useEffect(() => {
async function getDataUrl() {
const fetchedImage = await appContext.nyafile.getAssetDataUrl(props.src);
if(fetchedImage.startsWith("data:image/svg") && props.inlinesvg) {
const fetchedImage = await appContext.nyafile.getAssetDataUrl(src);
if(fetchedImage.startsWith("data:image/svg") && inlinesvg) {
setSvg(atob(fetchedImage.replace("data:image/svg+xml;base64,", '')))
} else {
setImage(fetchedImage)
}
}
getDataUrl();
}, [appContext.nyafile, appContext.nyafile.defaultFile, appContext.nyafile.nyaFile, props.src]);
}, [appContext.nyafile, appContext.nyafile.defaultFile, appContext.nyafile.nyaFile, src]);

// noinspection HtmlRequiredAltAttribute
if(!svg) return (
<img src={image} {...otherProps} />
<img {...props} src={image} />
)
return (
<div {...otherProps} dangerouslySetInnerHTML={{__html: svg}}/>
<div {...props} dangerouslySetInnerHTML={{__html: svg}}/>
)
}
4 changes: 3 additions & 1 deletion src/routes/QuarkView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export default function QuarkView() {
{isLoading ? null : <><QuarkHeader quark={data}/>
<LightquarkChannelList quark={data}/></>}

<Aviebox user={accounts.lightquark}/>
<div className={styles.avieboxWrap}>
<Aviebox user={accounts.lightquark}/>
</div>
</div>
<Outlet/>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/routes/QuarkView.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
display: flex;
flex-direction: column;
justify-content: space-between;

background: var(--background-color-less);
}

.channelListWrap > div[class*="_channelList_"] {
Expand All @@ -22,4 +24,8 @@
flex-direction: row;
flex-grow: 1;
background-color: var(--background-color-max);
}

.avieboxWrap {
margin-top: auto;
}
9 changes: 8 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ export default defineConfig({
plugins: [
react(),
basicSsl(),
sentryVitePlugin({}),
sentryVitePlugin({
bundleSizeOptimizations: {
excludeDebugStatements: true,
excludeReplayIframe: true,
excludeReplayShadowDom: true
},
reactComponentAnnotation: { enabled: true }
}),
],
test: {
globals: true,
Expand Down

1 comment on commit 61e88fc

@vercel
Copy link

@vercel vercel bot commented on 61e88fc Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.