Add wiki link to all generators

This commit is contained in:
Misode
2023-11-23 02:05:05 +01:00
parent 32a022d3a4
commit 2416095e4f
4 changed files with 78 additions and 42 deletions

View File

@@ -23,6 +23,7 @@ export interface ConfigGenerator {
partner?: string,
minVersion?: string,
maxVersion?: string,
wiki?: string,
}
export interface ConfigLegacyGuide {

View File

@@ -4,13 +4,13 @@ import { useCallback, useEffect, useErrorBoundary, useMemo, useRef, useState } f
import { Analytics } from '../../Analytics.js'
import type { ConfigGenerator } from '../../Config.js'
import config from '../../Config.js'
import { Store } from '../../Store.js'
import { cleanUrl, deepEqual } from '../../Utils.js'
import { DRAFT_PROJECT, useLocale, useProject, useVersion } from '../../contexts/index.js'
import { AsyncCancel, useActiveTimeout, useAsync, useModel, useSearchParam } from '../../hooks/index.js'
import { getOutput } from '../../schema/transformOutput.js'
import type { VersionId } from '../../services/index.js'
import { checkVersion, fetchPreset, getBlockStates, getCollections, getModel, getSnippet, shareSnippet } from '../../services/index.js'
import { Store } from '../../Store.js'
import { cleanUrl, deepEqual } from '../../Utils.js'
import { Ad, Btn, BtnMenu, ErrorPanel, FileCreation, FileRenaming, Footer, HasPreview, Octicon, PreviewPanel, ProjectCreation, ProjectDeletion, ProjectPanel, SearchList, SourcePanel, TextInput, Tree, VersionSwitcher } from '../index.js'
export const SHARE_KEY = 'share'
@@ -250,11 +250,6 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
Analytics.downloadOutput(gen.id, 'menu')
setDownload(doDownload + 1)
}
const importSource = () => {
Analytics.generatorEvent('import')
setSourceShown(true)
setImport(doImport + 1)
}
const toggleSource = () => {
if (sourceShown) {
Analytics.hideOutput(gen.id, 'menu')
@@ -308,7 +303,10 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
<main class={`generator${previewShown ? ' has-preview' : ''}${projectShown ? ' has-project' : ''}`}>
{!gen.partner && <Ad id="data-pack-generator" type="text" />}
<div class="controls generator-controls">
<Btn icon="upload" label={locale('import')} onClick={importSource} />
{gen.wiki && <a class="btn btn-link tooltipped tip-se" aria-label={locale('learn_on_the_wiki')} href={`https://minecraft.wiki/w/${gen.wiki}`} target="_blank">
{Octicon.mortar_board}
<span>{locale('wiki')}</span>
</a>}
<BtnMenu icon="archive" label={locale('presets')} relative={false}>
<SearchList searchPlaceholder={locale('search')} noResults={locale('no_presets')} values={presets} onSelect={selectPreset}/>
</BtnMenu>

View File

@@ -112,44 +112,51 @@
"id": "loot_table",
"url": "loot-table",
"path": "loot_tables",
"schema": "loot_table"
"schema": "loot_table",
"wiki": "Loot_table"
},
{
"id": "predicate",
"url": "predicate",
"path": "predicates",
"schema": "predicate"
"schema": "predicate",
"wiki": "Predicate"
},
{
"id": "item_modifier",
"url": "item-modifier",
"path": "item_modifiers",
"schema": "item_modifier",
"minVersion": "1.17"
"minVersion": "1.17",
"wiki": "Item modifier"
},
{
"id": "advancement",
"url": "advancement",
"path": "advancements",
"schema": "advancement"
"schema": "advancement",
"wiki": "Advancement/JSON_format"
},
{
"id": "recipe",
"url": "recipe",
"path": "recipes",
"schema": "recipe"
"schema": "recipe",
"wiki": "Recipe#JSON_format"
},
{
"id": "text_component",
"url": "text-component",
"schema": "text_component",
"noPath": true
"noPath": true,
"wiki": "Raw_JSON_text_format#Java_Edition"
},
{
"id": "damage_type",
"url": "damage-type",
"schema": "damage_type",
"minVersion": "1.19.4"
"minVersion": "1.19.4",
"wiki": "Damage_type"
},
{
"id": "chat_type",
@@ -172,21 +179,24 @@
{
"id": "pack_mcmeta",
"url": "pack-mcmeta",
"schema": "pack_mcmeta"
"schema": "pack_mcmeta",
"wiki": "Data_pack#pack.mcmeta"
},
{
"id": "dimension",
"url": "dimension",
"schema": "dimension",
"tags": ["worldgen"],
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Custom_dimension"
},
{
"id": "dimension_type",
"url": "dimension-type",
"schema": "dimension_type",
"tags": ["worldgen"],
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Dimension_type"
},
{
"id": "worldgen/biome",
@@ -200,42 +210,48 @@
"url": "worldgen/carver",
"tags": ["worldgen"],
"schema": "configured_carver",
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Custom_biome"
},
{
"id": "worldgen/configured_feature",
"url": "worldgen/feature",
"tags": ["worldgen"],
"schema": "configured_feature",
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Configured_feature"
},
{
"id": "worldgen/placed_feature",
"url": "worldgen/placed-feature",
"tags": ["worldgen"],
"schema": "placed_feature",
"minVersion": "1.18"
"minVersion": "1.18",
"wiki": "Placed_feature"
},
{
"id": "worldgen/density_function",
"url": "worldgen/density-function",
"tags": ["worldgen"],
"schema": "density_function",
"minVersion": "1.18.2"
"minVersion": "1.18.2",
"wiki": "Density_function"
},
{
"id": "worldgen/noise",
"url": "worldgen/noise",
"tags": ["worldgen"],
"schema": "noise_parameters",
"minVersion": "1.18"
"minVersion": "1.18",
"wiki": "Noise"
},
{
"id": "worldgen/noise_settings",
"url": "worldgen/noise-settings",
"tags": ["worldgen"],
"schema": "noise_settings",
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Custom_noise_settings"
},
{
"id": "worldgen/configured_structure_feature",
@@ -250,14 +266,16 @@
"url": "worldgen/structure",
"tags": ["worldgen"],
"schema": "structure",
"minVersion": "1.19"
"minVersion": "1.19",
"wiki": "Structure/JSON_format"
},
{
"id": "worldgen/structure_set",
"url": "worldgen/structure-set",
"tags": ["worldgen"],
"schema": "structure_set",
"minVersion": "1.18.2"
"minVersion": "1.18.2",
"wiki": "Structure_set"
},
{
"id": "worldgen/configured_surface_builder",
@@ -265,7 +283,8 @@
"tags": ["worldgen"],
"schema": "configured_surface_builder",
"minVersion": "1.16",
"maxVersion": "1.17"
"maxVersion": "1.17",
"wiki": "Configured_surface_builder"
},
{
"id": "worldgen/processor_list",
@@ -279,21 +298,24 @@
"url": "worldgen/template-pool",
"tags": ["worldgen"],
"schema": "template_pool",
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Processor_list"
},
{
"id": "worldgen/world_preset",
"url": "worldgen/world-preset",
"tags": ["worldgen"],
"schema": "world_preset",
"minVersion": "1.19"
"minVersion": "1.19",
"wiki": "Custom_world_preset"
},
{
"id": "worldgen/flat_level_generator_preset",
"url": "worldgen/flat-world-preset",
"tags": ["worldgen"],
"schema": "flat_level_generator_preset",
"minVersion": "1.19"
"minVersion": "1.19",
"wiki": "Custom_world_preset#Superflat_Level_Generation_Preset"
},
{
"id": "world",
@@ -301,28 +323,33 @@
"schema": "world_settings",
"noPath": true,
"tags": ["worldgen"],
"minVersion": "1.16"
"minVersion": "1.16",
"maxVersion": "1.19.3",
"wiki": "Custom"
},
{
"id": "tag/block",
"url": "tags/block",
"tags": ["tags"],
"path": "tags/blocks",
"schema": "block_tag"
"schema": "block_tag",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/entity_type",
"url": "tags/entity-type",
"tags": ["tags"],
"path": "tags/entity_types",
"schema": "entity_type_tag"
"schema": "entity_type_tag",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/fluid",
"url": "tags/fluid",
"tags": ["tags"],
"path": "tags/fluids",
"schema": "fluid_tag"
"schema": "fluid_tag",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/game_event",
@@ -330,14 +357,16 @@
"tags": ["tags"],
"path": "tags/game_events",
"schema": "game_event_tag",
"minVersion": "1.17"
"minVersion": "1.17",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/item",
"url": "tags/item",
"tags": ["tags"],
"path": "tags/items",
"schema": "item_tag"
"schema": "item_tag",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/worldgen/biome",
@@ -345,7 +374,8 @@
"tags": ["tags", "worldgen"],
"path": "tags/worldgen/biome",
"schema": "biome_tag",
"minVersion": "1.18.2"
"minVersion": "1.18.2",
"wiki": "Tag#Java_Edition"
},
{
"id": "tag/worldgen/structure",
@@ -353,21 +383,24 @@
"tags": ["tags", "worldgen"],
"path": "tags/worldgen/structure",
"schema": "structure_tag",
"minVersion": "1.19"
"minVersion": "1.19",
"wiki": "Tag#Java_Edition"
},
{
"id": "block_definition",
"url": "assets/blockstate",
"path": "blockstates",
"tags": ["assets"],
"schema": "block_definition"
"schema": "block_definition",
"wiki": "Tutorials/Models#Block_states"
},
{
"id": "model",
"url": "assets/model",
"path": "models",
"tags": ["assets"],
"schema": "model"
"schema": "model",
"wiki": "Tutorials/Models"
},
{
"id": "font",
@@ -375,7 +408,8 @@
"path": "font",
"tags": ["assets"],
"schema": "font",
"minVersion": "1.16"
"minVersion": "1.16",
"wiki": "Resource_pack#Fonts"
},
{
"id": "atlas",
@@ -383,7 +417,8 @@
"path": "atlases",
"tags": ["assets"],
"schema": "atlas",
"minVersion": "1.19.3"
"minVersion": "1.19.3",
"wiki": "Resource_pack#Atlases"
},
{
"id": "block_growth",

View File

@@ -90,6 +90,7 @@
"layer.erosion": "Erosion",
"layer.ridges": "Weirdness",
"layer.depth": "Depth",
"learn_on_the_wiki": "Learn on the wiki",
"highlighting": "Highlighting",
"loading": "Loading...",
"loot_table": "Loot Table",
@@ -255,6 +256,7 @@
"whats_new": "What's new?",
"whats_new.description": "Stay informed about all the latest development on misode.github.io. Read below to find out which features have recently been added.",
"whats_new.new": "NEW",
"wiki": "Wiki",
"world": "World Settings",
"worldgen": "Worldgen",
"worldgen/biome": "Biome",