UI updates
This commit is contained in:
parent
f74d0ee58a
commit
a97e72abd7
9 changed files with 183 additions and 101 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
"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",
|
||||||
|
"react-icons": "^4.8.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.0"
|
"web-vitals": "^2.1.0"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
BIN
frontend/public/favicon.png
Normal file
BIN
frontend/public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%PUBLIC_URL%/app-icon.png" />
|
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
||||||
<meta name="theme-color" content="#17a2b8" />
|
<meta name="theme-color" content="#17a2b8" />
|
||||||
<link rel="shortcut icon" href="./app-icon.png" type="image/x-icon" />
|
<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!" />
|
<meta name="description" content="A Migration Tool to Pull CF Files and Move Them to Modrinth!" />
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/app-icon.png" />
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.png" />
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
<title>CTMMM</title>
|
<title>CTMMM</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,33 @@
|
||||||
.output-log {
|
.output-log {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.info {
|
||||||
|
/* position: absolute;
|
||||||
|
bottom: 0.5rem;
|
||||||
|
right: 0.5rem; */
|
||||||
|
position: relative;
|
||||||
|
right: -100%;
|
||||||
|
|
||||||
|
font-size: 24px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 100%;
|
||||||
|
padding: 0.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.info svg {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctm-root {
|
||||||
|
margin: auto;
|
||||||
|
max-width: 768px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#root {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
|
||||||
41
frontend/src/components/Help/Delimiter.jsx
Normal file
41
frontend/src/components/Help/Delimiter.jsx
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { Modal } from 'react-bootstrap';
|
||||||
|
|
||||||
|
export default ({ show, onHide }) => (
|
||||||
|
<Modal
|
||||||
|
centered
|
||||||
|
show={show}
|
||||||
|
onHide={onHide}
|
||||||
|
>
|
||||||
|
<Modal.Body>
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
This is the splitter between parts of the filename. Many mods use the format
|
||||||
|
{' '}
|
||||||
|
<code>MODNAME-MCVER-MAJOR.MINOR.PATCH</code>
|
||||||
|
, where
|
||||||
|
{' '}
|
||||||
|
<code>-</code>
|
||||||
|
{' '}
|
||||||
|
is the delimiter.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Using this logic, it is assumed that the Minecraft version for this
|
||||||
|
{' '}
|
||||||
|
<code>.jar</code>
|
||||||
|
-file is between the first and second delimiter, and that the mod version is between
|
||||||
|
the second and the end of the file. Formatting aside from this is not supported,
|
||||||
|
unfortunately, as I've got a bit of trauma
|
||||||
|
{' '}
|
||||||
|
<sup>(/s)</sup>
|
||||||
|
{' '}
|
||||||
|
from
|
||||||
|
{' '}
|
||||||
|
<a href="https://dv2ls.com/code?id=lUY-c4A2H" target="_blank" rel="noreferrer">
|
||||||
|
this Regular Expression I wrote.
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Modal.Body>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
75
frontend/src/components/Help/Info.jsx
Normal file
75
frontend/src/components/Help/Info.jsx
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { Modal } from 'react-bootstrap';
|
||||||
|
|
||||||
|
export default ({ override, propagateOnHide }) => {
|
||||||
|
const [show, setShow] = useState(!window.localStorage.getItem('info-dismissed'));
|
||||||
|
|
||||||
|
const onHide = () => {
|
||||||
|
window.localStorage.setItem('info-dismissed', true);
|
||||||
|
setShow(false);
|
||||||
|
propagateOnHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
centered
|
||||||
|
size="lg"
|
||||||
|
show={override || show}
|
||||||
|
onHide={onHide}
|
||||||
|
>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>CurseForge to Modrinth Mod Migrator (CTMMM)</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
<p>
|
||||||
|
<b>Welcome!</b>
|
||||||
|
{' '}
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
|
</Modal.Body>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
import React, { useState } from 'react';
|
|
||||||
|
|
||||||
export default () => {
|
|
||||||
const [render, setRender] = useState(true);
|
|
||||||
|
|
||||||
const hide = () => {
|
|
||||||
window.localStorage.setItem('info-dismissed', true);
|
|
||||||
setRender(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return render && (
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
<b>Welcome!</b>
|
|
||||||
{' '}
|
|
||||||
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>
|
|
||||||
|
|
||||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
||||||
<a style={{ float: 'right', marginTop: '-2rem' }} href="#" role="button" onClick={hide}><sup>[Hide]</sup></a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
BIN
frontend/src/img/ctm.png
Normal file
BIN
frontend/src/img/ctm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
|
|
@ -1,12 +1,16 @@
|
||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Form, Button, Container, Accordion, Modal,
|
Form, Button, Container, Accordion, Image,
|
||||||
} from 'react-bootstrap';
|
} from 'react-bootstrap';
|
||||||
|
import { TbInfoHexagon, TbHelp } from 'react-icons/tb';
|
||||||
import OutputLog from '../components/OutputLog';
|
import OutputLog from '../components/OutputLog';
|
||||||
import Info from '../components/Info';
|
import Info from '../components/Help/Info';
|
||||||
|
import Delimiter from '../components/Help/Delimiter';
|
||||||
|
import HeaderImg from '../img/ctm.png';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [help, setHelp] = useState(null);
|
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({
|
||||||
githubPat: '',
|
githubPat: '',
|
||||||
|
|
@ -16,39 +20,6 @@ export default () => {
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
const isValidState = () => !!formData.githubPat.length && !!formData.slug.length && !!formData.projId.length;
|
const isValidState = () => !!formData.githubPat.length && !!formData.slug.length && !!formData.projId.length;
|
||||||
const delimHelp = (evt) => {
|
|
||||||
evt.preventDefault();
|
|
||||||
setHelp((
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
This is the splitter between parts of the filename. Geolosys uses format
|
|
||||||
{' '}
|
|
||||||
<code>MODNAME-MCVER-MAJOR.MINOR.PATCH</code>
|
|
||||||
, where
|
|
||||||
{' '}
|
|
||||||
<code>-</code>
|
|
||||||
{' '}
|
|
||||||
is the delimiter.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Using this logic, it is assumed that the Minecraft version for this
|
|
||||||
{' '}
|
|
||||||
<code>.jar</code>
|
|
||||||
-file is between the first and second delimiter, and that the mod version is between
|
|
||||||
the second and the end of the file. Formatting aside from this is not supported,
|
|
||||||
unfortunately, as I've got a bit of trauma
|
|
||||||
{' '}
|
|
||||||
<sup>(/s)</sup>
|
|
||||||
{' '}
|
|
||||||
from
|
|
||||||
{' '}
|
|
||||||
<a href="https://dv2ls.com/code?id=lUY-c4A2H" target="_blank" rel="noreferrer">
|
|
||||||
this Regular Expression I wrote.
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
};
|
|
||||||
|
|
||||||
const makeJob = async (evt) => {
|
const makeJob = async (evt) => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
@ -68,14 +39,12 @@ export default () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ margin: 'auto', maxWidth: '768px' }}>
|
<div className="ctm-root">
|
||||||
<h2 className="mb-4 text-center">
|
<Info override={modals.info} propagateOnHide={() => setModals({ ...modals, info: false })} />
|
||||||
CurseForge to Modrinth Mod Migrator (CTMMM)
|
<Delimiter show={modals.delim} onHide={() => setModals({ ...modals, delim: false })} />
|
||||||
</h2>
|
|
||||||
|
|
||||||
{!window.localStorage.getItem('info-dismissed') && (<Info />)}
|
|
||||||
|
|
||||||
<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} />
|
||||||
<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>
|
||||||
|
|
@ -127,7 +96,14 @@ export default () => {
|
||||||
Delimiter (Optional)
|
Delimiter (Optional)
|
||||||
{' '}
|
{' '}
|
||||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
||||||
<a onClick={delimHelp} style={{ textDecoration: 'none' }} href="#">❔</a>
|
<a
|
||||||
|
onClick={() => setModals({ ...modals, delim: true })}
|
||||||
|
style={{ textDecoration: 'none', fontSize: '16px' }}
|
||||||
|
href="#"
|
||||||
|
label="delimiter_help"
|
||||||
|
>
|
||||||
|
<TbHelp />
|
||||||
|
</a>
|
||||||
</Form.Label>
|
</Form.Label>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
placeholder="Defaults to Hyphen (-)"
|
placeholder="Defaults to Hyphen (-)"
|
||||||
|
|
@ -141,7 +117,7 @@ export default () => {
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="success"
|
variant="dark"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!isValidState()}
|
disabled={!isValidState()}
|
||||||
>
|
>
|
||||||
|
|
@ -165,9 +141,20 @@ export default () => {
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<Modal centered show={!!help} onHide={() => setHelp(null)}>
|
<Button
|
||||||
|
onClick={() => setModals({ ...modals, info: true })}
|
||||||
|
className="info"
|
||||||
|
variant="dark"
|
||||||
|
>
|
||||||
|
<TbInfoHexagon ce />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{/* <Modal centered show={!!help} onHide={() => setHelp(null)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Help</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
<Modal.Body>{help}</Modal.Body>
|
<Modal.Body>{help}</Modal.Body>
|
||||||
</Modal>
|
</Modal> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue