diff --git a/src/app/components/Octicon.tsx b/src/app/components/Octicon.tsx index 68acfd40..2adb2d03 100644 --- a/src/app/components/Octicon.tsx +++ b/src/app/components/Octicon.tsx @@ -37,6 +37,7 @@ export const Octicon = { lock: , mark_github: , moon: , + mortar_board: , package: , pencil: , play: , diff --git a/src/app/pages/Customized.tsx b/src/app/pages/Customized.tsx index 62c2a353..763a1c72 100644 --- a/src/app/pages/Customized.tsx +++ b/src/app/pages/Customized.tsx @@ -6,7 +6,7 @@ import { generateCustomized } from '../components/customized/CustomizedGenerator import { CustomizedModel } from '../components/customized/CustomizedModel.js' import { OresSettings } from '../components/customized/OresSettings.jsx' import { StructuresSettings } from '../components/customized/StructuresSettings.jsx' -import { Btn, ErrorPanel, Footer, VersionSwitcher } from '../components/index.js' +import { Btn, ErrorPanel, Footer, Octicon, VersionSwitcher } from '../components/index.js' import { useLocale, useTitle } from '../contexts/index.js' import { useSearchParam } from '../hooks/index.js' import { stringifySource } from '../services/Source.js' @@ -43,9 +43,17 @@ export function Customized({}: Props) { const initialModel = useMemo(() => { return CustomizedModel.getDefault(version) }, [version]) + const isModified = useMemo(() => { + return !deepEqual(model, initialModel) + }, [model, initialModel]) + + const reset = useCallback(() => { + setModel(deepClone(initialModel)) + }, [initialModel]) const download = useRef(null) const [error, setError] = useState(null) + const [hasDownloaded, setHasDownloaded] = useState(false) const generate = useCallback(async () => { if (!download.current) return try { @@ -63,6 +71,7 @@ export function Customized({}: Props) { download.current.setAttribute('href', url) download.current.setAttribute('download', 'customized.zip') download.current.click() + setHasDownloaded(true) setError(null) } catch (e) { if (e instanceof Error) { @@ -86,10 +95,24 @@ export function Customized({}: Props) { {tab === 'ores' && } - + + {isModified && } {error && setError(null)} body={`\n### Customized settings\n\n\n${JSON.stringify(getDiffModel(model, initialModel), null, 2)}\n\n\n`} />} + {hasDownloaded && + + {Octicon.mortar_board} + What now? + + + After launching Minecraft, create a new singleplayer world. + Select the "More" tab at the top. + Click on "Data Packs" and drag the downloaded zip file onto the game window. + Move the imported data pack to the right panel and click on "Done". + A message will warn about the use of experimental world settings. Click on "Proceed". + + } diff --git a/src/styles/global.css b/src/styles/global.css index 6b8618fc..ecd365ca 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -664,8 +664,12 @@ main.has-project { padding-bottom: 30px; } -.customized-actions > span { - color: var(--text-3); +.customized-actions { + display: flex; + align-items: center; +} + +.customized-actions > *:not(:first-child) { margin-left: 10px; } @@ -686,6 +690,35 @@ main.has-project { margin-right: 10px; } +.customized-instructions { + margin-top: 5px; + padding: 5px; + color: var(--text-2); +} + + +.customized-instructions h4 { + display: flex; + align-items: center; + margin: 10px 0; +} + +.customized-instructions svg { + fill: var(--accent-primary); + width: 24px; + height: 24px; + margin-right: 10px; +} + +.customized-instructions ol { + margin-left: 25px; +} + +.customized-instructions li { + margin: 6px 0; + color: var(--text-3); +} + .customized > .error { margin-left: 0; margin-right: 0; @@ -1240,6 +1273,7 @@ main.has-project { color: var(--text-1); border-radius: 6px; font-size: 14px; + font-weight: normal; line-height: 1.5; text-align: left; opacity: 0;
\n${JSON.stringify(getDiffModel(model, initialModel), null, 2)}\n