Cleanup UI, auto dark mode & more
This commit is contained in:
parent
2d39dc445c
commit
6109631b62
5 changed files with 94 additions and 75 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.7",
|
||||
"bootstrap": "^5.2.3",
|
||||
"bootstrap": "^5.3.0-alpha3",
|
||||
"react": "18.2.0",
|
||||
"react-bootstrap": "^2.7.4",
|
||||
"react-dom": "18.2.0",
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html data-bs-theme="light">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
||||
<meta name="theme-color" content="#17a2b8" />
|
||||
<link rel="shortcut icon" href="./favicon.png" type="image/x-icon" />
|
||||
<meta name="description" content="A Migration Tool to Pull CF Files and Move Them to Modrinth!" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.png" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<link rel="shortcut icon" href="./favicon.png" type="image/x-icon" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="description" content="A Migration Tool to Pull CF Files and Move Them to Modrinth!" />
|
||||
<meta name="theme-color" content="#1bd968" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>CTMMM</title>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@
|
|||
}
|
||||
|
||||
button.info {
|
||||
/* position: absolute;
|
||||
bottom: 0.5rem;
|
||||
right: 0.5rem; */
|
||||
position: relative;
|
||||
right: -100%;
|
||||
|
||||
font-size: 24px;
|
||||
float: right;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 100%;
|
||||
padding: 0.5rem !important;
|
||||
|
|
@ -37,3 +31,8 @@ button.info svg {
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerimg {
|
||||
filter: drop-shadow(1.15px 1.15px 0 #ffffff30)
|
||||
drop-shadow(-1.15px -1.15px 0 #ffffff30);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,48 +27,43 @@ export default ({ override, propagateOnHide }) => {
|
|||
In order to use this tool you'll need to have already created (if it's
|
||||
still "Under Review", that's ok) your Modrinth Page, and a few
|
||||
other things:
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
A
|
||||
{' '}
|
||||
<a href="https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token" target="_blank" rel="noreferrer">
|
||||
GitHub Personal Access Token
|
||||
</a>
|
||||
{' '}
|
||||
for the Account you used to log into Modrinth. No
|
||||
permissions need to be granted to the PAT, this token will be encrypted from end
|
||||
to end (even in storage), and it will only be used for requests to Modrinth
|
||||
(feel encouraged to browse this source code to verify).
|
||||
</li>
|
||||
<li>
|
||||
The CurseForge Slug for your Mod. This can be found in the General Settings for your
|
||||
project page
|
||||
</li>
|
||||
<li>
|
||||
The Modrinth Project ID. This can be found in the side panel of your Modrinth project
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
This tool works on a queue-based system since I cannot afford enough computing for
|
||||
everyone, so you'll be able to see your status and place in the queue down
|
||||
below in the "Status & Output Log". You will not lose your place in
|
||||
the queue if you close this tab or leave this page, as long as you do not clear
|
||||
browser storage you will still be able to track progress here, or of course on
|
||||
your Modrinth project page!
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
A
|
||||
{' '}
|
||||
<a href="https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token" target="_blank" rel="noreferrer">
|
||||
GitHub Personal Access Token
|
||||
</a>
|
||||
{' '}
|
||||
for the Account you used to log into Modrinth. No
|
||||
permissions need to be granted to the PAT, this token will be encrypted from end
|
||||
to end (even in storage), and it will only be used for requests to Modrinth
|
||||
(feel encouraged to browse this source code to verify).
|
||||
</li>
|
||||
<li>
|
||||
The CurseForge Slug for your Mod. This can be found in the General Settings for your
|
||||
project page
|
||||
</li>
|
||||
<li>
|
||||
The Modrinth Project ID. This can be found in the side panel of your Modrinth project
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
I want to make this process go faster, so if you liked it and want to support it you can:
|
||||
<ul>
|
||||
<li>
|
||||
Support me
|
||||
{' '}
|
||||
<a href="https://dv2ls.com/don8" target="_blank" rel="noreferrer">with a Donation</a>
|
||||
</li>
|
||||
<li>Share this tool!</li>
|
||||
</ul>
|
||||
This tool works on a queue-based system since this process is pretty slow.
|
||||
I apologize that it might take a while to process, but while you wait you can always:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Support me
|
||||
{' '}
|
||||
<a href="https://dv2ls.com/don8" target="_blank" rel="noreferrer">with a Donation</a>
|
||||
</li>
|
||||
<li>Share this tool on Social Media!</li>
|
||||
</ul>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Form, Button, Container, Accordion, Image,
|
||||
} from 'react-bootstrap';
|
||||
|
|
@ -10,6 +10,7 @@ import Delimiter from '../components/Help/Delimiter';
|
|||
import HeaderImg from '../img/ctm.png';
|
||||
|
||||
export default () => {
|
||||
const [dark, setDark] = useState(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
const [modals, setModals] = useState({ info: false, delim: false });
|
||||
const [jobId, setJobId] = useState(window.localStorage.getItem('last-jobid'));
|
||||
const [formData, setFormData] = useState({
|
||||
|
|
@ -18,12 +19,28 @@ export default () => {
|
|||
modrinthId: '',
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
const isValidState = () => !!formData.githubPat.length && !!formData.curseforgeSlug.length && !!formData.modrinthId.length;
|
||||
useEffect(() => { // DARK MODE STUFF HERE
|
||||
// Set initial state before even bothering with the update state
|
||||
window.document.scrollingElement.setAttribute('data-bs-theme', dark ? 'dark' : 'light');
|
||||
|
||||
const pref = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
const onChange = (query) => {
|
||||
window.document.scrollingElement.setAttribute(
|
||||
'data-bs-theme',
|
||||
query.matches ? 'dark' : 'light',
|
||||
);
|
||||
setDark(query.matches);
|
||||
};
|
||||
|
||||
pref.addEventListener('change', onChange);
|
||||
return () => pref.removeEventListener('change', onChange);
|
||||
}, [dark, setDark]);
|
||||
|
||||
const makeJob = async (evt) => {
|
||||
evt.preventDefault();
|
||||
if (!isValidState()) return;
|
||||
if (!formData.githubPat.length()) return;
|
||||
if (!formData.curseforgeSlug.length()) return;
|
||||
if (!formData.modrinthId.length()) return;
|
||||
|
||||
const resp = await fetch('/api/v1/jobs', {
|
||||
method: 'PUT',
|
||||
|
|
@ -44,7 +61,23 @@ export default () => {
|
|||
<Delimiter show={modals.delim} onHide={() => setModals({ ...modals, delim: false })} />
|
||||
|
||||
<Container style={{ margin: '1rem auto', maxWidth: '512px' }}>
|
||||
<Image className="d-block mb-3 mx-auto w-50 " src={HeaderImg} />
|
||||
<Image className="d-block mb-3 mx-auto w-50 headerimg" src={HeaderImg} />
|
||||
<p className="text-center" style={{ fontSize: '1.25rem' }}>
|
||||
<b>C</b>
|
||||
urse
|
||||
{' '}
|
||||
<b>T</b>
|
||||
o
|
||||
{' '}
|
||||
<b>M</b>
|
||||
odrinth
|
||||
{' '}
|
||||
<b>M</b>
|
||||
od
|
||||
{' '}
|
||||
<b>M</b>
|
||||
igrator
|
||||
</p>
|
||||
<Form onSubmit={makeJob} className="juse-form">
|
||||
<Form.Group className="mb-3" controlId="githubPat">
|
||||
<Form.Label>GitHub Personal Access Token</Form.Label>
|
||||
|
|
@ -116,12 +149,14 @@ export default () => {
|
|||
/>
|
||||
</Form.Group>
|
||||
|
||||
<Button variant={dark ? 'light' : 'dark'} type="submit">Submit</Button>
|
||||
<Button
|
||||
variant="dark"
|
||||
type="submit"
|
||||
disabled={!isValidState()}
|
||||
className="info"
|
||||
onClick={() => setModals({ ...modals, info: true })}
|
||||
variant={dark ? 'light' : 'dark'}
|
||||
type="button"
|
||||
>
|
||||
Submit
|
||||
<TbInfoHexagon />
|
||||
</Button>
|
||||
</Form>
|
||||
|
||||
|
|
@ -141,20 +176,11 @@ export default () => {
|
|||
)}
|
||||
</Container>
|
||||
|
||||
<Button
|
||||
onClick={() => setModals({ ...modals, info: true })}
|
||||
className="info"
|
||||
variant="dark"
|
||||
>
|
||||
<TbInfoHexagon ce />
|
||||
</Button>
|
||||
{/* <Button
|
||||
|
||||
{/* <Modal centered show={!!help} onHide={() => setHelp(null)}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Help</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>{help}</Modal.Body>
|
||||
</Modal> */}
|
||||
className="info"
|
||||
variant="light"
|
||||
/> */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue