From: Daniel Karbach Date: Fri, 13 Jan 2023 13:24:54 +0000 (+0100) Subject: tech ruleset classification X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=de9be1288c2b3214e007c8d67d6b19e756cf08ba;p=alttp.git tech ruleset classification --- diff --git a/app/Models/Technique.php b/app/Models/Technique.php index f0a29d3..c8ad91b 100644 --- a/app/Models/Technique.php +++ b/app/Models/Technique.php @@ -30,6 +30,7 @@ class Technique extends Model protected $casts = [ 'index' => 'boolean', + 'rulesets' => 'array', ]; protected $with = [ diff --git a/database/migrations/2022_08_19_080601_tech_index.php b/database/migrations/2022_08_19_080601_tech_index.php index d1b6d6e..e0f615a 100644 --- a/database/migrations/2022_08_19_080601_tech_index.php +++ b/database/migrations/2022_08_19_080601_tech_index.php @@ -26,7 +26,7 @@ return new class extends Migration */ public function down() { - Schema::table('rounds', function(Blueprint $table) { + Schema::table('techniques', function(Blueprint $table) { $table->dropColumn('index'); $table->dropColumn('priority'); }); diff --git a/database/migrations/2023_01_13_121640_tech_ruleset.php b/database/migrations/2023_01_13_121640_tech_ruleset.php new file mode 100644 index 0000000..1765f40 --- /dev/null +++ b/database/migrations/2023_01_13_121640_tech_ruleset.php @@ -0,0 +1,32 @@ +text('rulesets')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('techniques', function(Blueprint $table) { + $table->dropColumn('rulesets'); + }); + } +}; diff --git a/resources/js/components/common/Icon.js b/resources/js/components/common/Icon.js index 581ce6f..bce75f5 100644 --- a/resources/js/components/common/Icon.js +++ b/resources/js/components/common/Icon.js @@ -59,6 +59,7 @@ const makePreset = (presetDisplayName, presetName) => { Icon.ACCEPT = makePreset('AcceptIcon', 'square-check'); Icon.ADD = makePreset('AddIcon', 'circle-plus'); +Icon.ALLOWED = makePreset('AllowedIcon', 'square-check'); Icon.APPLY = makePreset('ApplyIcon', 'right-to-bracket'); Icon.APPLICATIONS = makePreset('ApplicationsIcon', 'person-running'); Icon.CHART = makePreset('ChartIcon', 'chart-line'); @@ -66,6 +67,7 @@ Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']); Icon.EDIT = makePreset('EditIcon', 'edit'); Icon.FINISHED = makePreset('FinishedIcon', 'square-check'); Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy'); +Icon.FORBIDDEN = makePreset('ForbiddenIcon', 'square-xmark'); Icon.FORFEIT = makePreset('ForfeitIcon', 'square-xmark'); Icon.LANGUAGE = makePreset('LanguageIcon', 'language'); Icon.LOCKED = makePreset('LockedIcon', 'lock'); @@ -80,6 +82,7 @@ Icon.SETTINGS = makePreset('SettingsIcon', 'cog'); Icon.STREAM = makePreset('StreamIcon', ['fab', 'twitch']); Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award'); Icon.TWITCH = makePreset('TwitchIcon', ['fab', 'twitch']); +Icon.UNKNOWN = makePreset('UnknownIcon', 'square-question'); Icon.UNLOCKED = makePreset('UnlockedIcon', 'lock-open'); Icon.VIDEO = makePreset('VideoIcon', 'video'); Icon.YOUTUBE = makePreset('YoutubeIcon', ['fab', 'youtube']); diff --git a/resources/js/components/techniques/Detail.js b/resources/js/components/techniques/Detail.js index 488205b..6653923 100644 --- a/resources/js/components/techniques/Detail.js +++ b/resources/js/components/techniques/Detail.js @@ -5,6 +5,7 @@ import { withTranslation } from 'react-i18next'; import List from './List'; import Outline from './Outline'; +import Rulesets from './Rulesets'; import RawHTML from '../common/RawHTML'; import { getRelations, @@ -15,7 +16,12 @@ import { import i18n from '../../i18n'; const Detail = ({ technique }) => -

{getTranslation(technique, 'title', i18n.language)}

+
+

{getTranslation(technique, 'title', i18n.language)}

+ {technique && technique.rulesets ? + + : null} +
{technique.chapters ? technique.chapters.map(chapter => @@ -41,6 +47,8 @@ Detail.propTypes = { chapters: PropTypes.arrayOf(PropTypes.shape({ })), description: PropTypes.string, + rulesets: PropTypes.shape({ + }), title: PropTypes.string, }), }; diff --git a/resources/js/components/techniques/List.js b/resources/js/components/techniques/List.js index 58f0eae..e18937e 100644 --- a/resources/js/components/techniques/List.js +++ b/resources/js/components/techniques/List.js @@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { Link } from 'react-router-dom'; +import Rulesets from './Rulesets'; import { getLink, getTranslation, @@ -10,13 +11,18 @@ import i18n from '../../i18n'; const List = ({ techniques }) =>
    {techniques.map(tech => -
  • -

    - - {getTranslation(tech, 'title', i18n.language)} - -

    -

    {getTranslation(tech, 'short', i18n.language)}

    +
  • +
    +

    + + {getTranslation(tech, 'title', i18n.language)} + +

    +

    {getTranslation(tech, 'short', i18n.language)}

    +
    + {tech.rulesets ? + + : null}
  • )}
; diff --git a/resources/js/components/techniques/Rulesets.js b/resources/js/components/techniques/Rulesets.js new file mode 100644 index 0000000..6d4ee50 --- /dev/null +++ b/resources/js/components/techniques/Rulesets.js @@ -0,0 +1,36 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; + +import Icon from '../common/Icon'; + +const Rulesets = ({ technique }) => { + const { t } = useTranslation(); + + return
+ {['competitive', 'owg', 'mg', 'nl'].map(r => + + {technique && technique.rulesets && technique.rulesets[r] ? + + : null} + {technique && technique.rulesets && !technique.rulesets[r] ? + + : null} + {!technique || !technique.rulesets ? + + : null} + {' '} + {t(`techniques.rulesetCodes.${r}`)} + + )} +
; +}; + +Rulesets.propTypes = { + technique: PropTypes.shape({ + rulesets: PropTypes.shape({ + }), + }), +}; + +export default Rulesets; diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index e77d1de..1334fde 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -294,6 +294,7 @@ export default { }, icon: { AddIcon: 'Hinzufügen', + AllowedIcon: 'Erlaubt', ApplicationsIcon: 'Anträge', ApplyIcon: 'Beantragen', ChartIcon: 'Diagramm', @@ -301,6 +302,7 @@ export default { EditIcon: 'Bearbeiten', FinishedIcon: 'Abgeschlossen', FirstPlaceIcon: 'Erster Platz', + ForbiddenIcon: 'Verboten', ForfeitIcon: 'Aufgegeben', LanguageIcon: 'Sprache', LockedIcon: 'Gesperrt', @@ -313,6 +315,7 @@ export default { StreamIcon: 'Stream', ThirdPlaceIcon: 'Dritter Platz', TwitchIcon: 'Twitch', + UnknownIcon: 'Unbekannt', UnlockedIcon: 'Offen', YoutubeIcon: 'YouTube', VideoIcon: 'Video', @@ -486,6 +489,18 @@ export default { }, techniques: { heading: 'Techniken', + rulesetCodes: { + competitive: 'COM', + mg: 'MG', + nl: 'NL', + owg: 'OWG', + }, + rulesetDescriptions: { + competitive: 'Competitive', + mg: 'Major Glitches', + nl: 'No Logic', + owg: 'Overworld Glitches', + }, seeAlso: 'Siehe auch', }, tournaments: { diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index 5a6695a..d4e61bb 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -294,6 +294,7 @@ export default { }, icon: { AddIcon: 'Add', + AllowedIcon: 'Allowed', ApplicationsIcon: 'Applications', ApplyIcon: 'Apply', ChartIcon: 'Chart', @@ -301,6 +302,7 @@ export default { EditIcon: 'Edit', FinishedIcon: 'Finished', FirstPlaceIcon: 'First Place', + ForbiddenIcon: 'Forbidden', ForfeitIcon: 'Forfeit', LanguageIcon: 'Language', LockedIcon: 'Locked', @@ -313,6 +315,7 @@ export default { StreamIcon: 'Stream', ThirdPlaceIcon: 'Third Place', TwitchIcon: 'Twitch', + UnknownIcon: 'Unknown', UnlockedIcon: 'Unlocked', YoutubeIcon: 'YouTube', VideoIcon: 'Video', @@ -486,6 +489,18 @@ export default { }, techniques: { heading: 'Techniques', + rulesetCodes: { + competitive: 'COM', + mg: 'MG', + nl: 'NL', + owg: 'OWG', + }, + rulesetDescriptions: { + competitive: 'Competitive', + mg: 'Major Glitches', + nl: 'No Logic', + owg: 'Overworld Glitches', + }, seeAlso: 'See also', }, tournaments: { diff --git a/resources/sass/techniques.scss b/resources/sass/techniques.scss index 19dcf41..a28c438 100644 --- a/resources/sass/techniques.scss +++ b/resources/sass/techniques.scss @@ -1,3 +1,11 @@ +.ruleset-box { + display: inline-grid; + grid-template-columns: 1fr 1fr; + gap: 0 1ex; + padding: 0.5ex; + border-radius: 0.5ex; +} + .tech-list { margin: 1em 0; padding: 0;