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,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.11.7",
|
"@popperjs/core": "^2.11.7",
|
||||||
"bootstrap": "^5.2.3",
|
"bootstrap": "^5.3.0-alpha3",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-bootstrap": "^2.7.4",
|
"react-bootstrap": "^2.7.4",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html data-bs-theme="light">
|
||||||
|
|
||||||
<head>
|
<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="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="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>
|
<title>CTMMM</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
button.info {
|
button.info {
|
||||||
/* position: absolute;
|
float: right;
|
||||||
bottom: 0.5rem;
|
|
||||||
right: 0.5rem; */
|
|
||||||
position: relative;
|
|
||||||
right: -100%;
|
|
||||||
|
|
||||||
font-size: 24px;
|
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
padding: 0.5rem !important;
|
padding: 0.5rem !important;
|
||||||
|
|
@ -37,3 +31,8 @@ button.info svg {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: 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
|
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
|
still "Under Review", that's ok) your Modrinth Page, and a few
|
||||||
other things:
|
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>
|
</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>
|
<p>
|
||||||
I want to make this process go faster, so if you liked it and want to support it you can:
|
This tool works on a queue-based system since this process is pretty slow.
|
||||||
<ul>
|
I apologize that it might take a while to process, but while you wait you can always:
|
||||||
<li>
|
|
||||||
Support me
|
|
||||||
{' '}
|
|
||||||
<a href="https://dv2ls.com/don8" target="_blank" rel="noreferrer">with a Donation</a>
|
|
||||||
</li>
|
|
||||||
<li>Share this tool!</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
</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.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
import React, { useState } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import {
|
import {
|
||||||
Form, Button, Container, Accordion, Image,
|
Form, Button, Container, Accordion, Image,
|
||||||
} from 'react-bootstrap';
|
} from 'react-bootstrap';
|
||||||
|
|
@ -10,6 +10,7 @@ import Delimiter from '../components/Help/Delimiter';
|
||||||
import HeaderImg from '../img/ctm.png';
|
import HeaderImg from '../img/ctm.png';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
const [dark, setDark] = useState(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||||
const [modals, setModals] = useState({ info: false, delim: false });
|
const [modals, setModals] = useState({ info: false, delim: false });
|
||||||
const [jobId, setJobId] = useState(window.localStorage.getItem('last-jobid'));
|
const [jobId, setJobId] = useState(window.localStorage.getItem('last-jobid'));
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
|
|
@ -18,12 +19,28 @@ export default () => {
|
||||||
modrinthId: '',
|
modrinthId: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
useEffect(() => { // DARK MODE STUFF HERE
|
||||||
const isValidState = () => !!formData.githubPat.length && !!formData.curseforgeSlug.length && !!formData.modrinthId.length;
|
// 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) => {
|
const makeJob = async (evt) => {
|
||||||
evt.preventDefault();
|
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', {
|
const resp = await fetch('/api/v1/jobs', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
|
@ -44,7 +61,23 @@ export default () => {
|
||||||
<Delimiter show={modals.delim} onHide={() => setModals({ ...modals, delim: false })} />
|
<Delimiter show={modals.delim} onHide={() => setModals({ ...modals, delim: false })} />
|
||||||
|
|
||||||
<Container style={{ margin: '1rem auto', maxWidth: '512px' }}>
|
<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 onSubmit={makeJob} className="juse-form">
|
||||||
<Form.Group className="mb-3" controlId="githubPat">
|
<Form.Group className="mb-3" controlId="githubPat">
|
||||||
<Form.Label>GitHub Personal Access Token</Form.Label>
|
<Form.Label>GitHub Personal Access Token</Form.Label>
|
||||||
|
|
@ -116,12 +149,14 @@ export default () => {
|
||||||
/>
|
/>
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
|
|
||||||
|
<Button variant={dark ? 'light' : 'dark'} type="submit">Submit</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="dark"
|
className="info"
|
||||||
type="submit"
|
onClick={() => setModals({ ...modals, info: true })}
|
||||||
disabled={!isValidState()}
|
variant={dark ? 'light' : 'dark'}
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
Submit
|
<TbInfoHexagon />
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
|
@ -141,20 +176,11 @@ export default () => {
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<Button
|
{/* <Button
|
||||||
onClick={() => setModals({ ...modals, info: true })}
|
|
||||||
className="info"
|
|
||||||
variant="dark"
|
|
||||||
>
|
|
||||||
<TbInfoHexagon ce />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
{/* <Modal centered show={!!help} onHide={() => setHelp(null)}>
|
className="info"
|
||||||
<Modal.Header closeButton>
|
variant="light"
|
||||||
<Modal.Title>Help</Modal.Title>
|
/> */}
|
||||||
</Modal.Header>
|
|
||||||
<Modal.Body>{help}</Modal.Body>
|
|
||||||
</Modal> */}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue