diff --git a/livesplit-core b/livesplit-core index a7c9df2..d55aca7 160000 --- a/livesplit-core +++ b/livesplit-core @@ -1 +1 @@ -Subproject commit a7c9df2ef1da927e743bd4a0783a5266d70ac402 +Subproject commit d55aca7619f5c36d28bf8c57509d366f1a22b2e5 diff --git a/src/api/SpeedrunCom.ts b/src/api/SpeedrunCom.ts index 3075814..23ba241 100644 --- a/src/api/SpeedrunCom.ts +++ b/src/api/SpeedrunCom.ts @@ -52,7 +52,7 @@ export interface VariableValues { export interface VariableValue { label: string, - rules?: string, + rules?: Option, } export interface GameHeader { diff --git a/src/css/Tooltip.scss b/src/css/Tooltip.scss new file mode 100644 index 0000000..91245c1 --- /dev/null +++ b/src/css/Tooltip.scss @@ -0,0 +1,30 @@ +@import 'variables'; + +.tooltip { + position: relative; + display: inline-block; +} + +.tooltip .tooltip-text { + visibility: hidden; + width: 300px; + background-color: $sidebar-background-color; + border: 1px solid $border-color; + color: #fff; + text-align: center; + border-radius: 6px; + padding: $ui-margin; + position: absolute; + z-index: 1; + bottom: calc(100% + $ui-margin); + left: 50%; + margin-left: -150px; + opacity: 0; + transition: opacity 0.25s; + transition-delay: 0.5s; +} + +.tooltip:hover .tooltip-text { + visibility: visible; + opacity: 1; +} diff --git a/src/ui/RunEditor.tsx b/src/ui/RunEditor.tsx index d7a51d1..7ef9026 100644 --- a/src/ui/RunEditor.tsx +++ b/src/ui/RunEditor.tsx @@ -696,6 +696,7 @@ export class RunEditor extends React.Component { if (this.variableIsValidForCategory(variable, category)) { speedrunComVariables.push({ text: variable.name, + tooltip: "A variable on speedrun.com specific to the game.", value: { CustomCombobox: { value: metadata.speedrun_com_variables[variable.name] || "", @@ -711,6 +712,7 @@ export class RunEditor extends React.Component { regionOffset = fields.length; fields.push({ text: "Region", + tooltip: "The region of the game that is being played.", value: { CustomCombobox: { value: metadata.region_name, @@ -724,6 +726,7 @@ export class RunEditor extends React.Component { platformOffset = fields.length; fields.push({ text: "Platform", + tooltip: "The platform that the game is being played on.", value: { CustomCombobox: { value: metadata.platform_name, @@ -737,6 +740,7 @@ export class RunEditor extends React.Component { emulatorOffset = fields.length; fields.push({ text: "Uses Emulator", + tooltip: "Whether an emulator is being used to play the game.", value: { Bool: metadata.uses_emulator, }, @@ -749,6 +753,7 @@ export class RunEditor extends React.Component { if (customVariableValue && customVariableValue.is_permanent) { customVariables.push({ text: customVariableName, + tooltip: "A custom variable specified by you. These can be displayed with the text component.", value: { RemovableString: customVariableValue.value, }, @@ -1106,7 +1111,7 @@ export class RunEditor extends React.Component { if (this.variableIsValidForCategory(variable, category) && variable["is-subcategory"]) { const currentValue = this.state.editor.metadata.speedrun_com_variables[variable.name]; const foundValue = Object.values(variable.values.values).find((v) => v.label === currentValue); - if (foundValue !== undefined && foundValue.rules !== undefined) { + if (foundValue?.rules != null) { subcategoryRules.push(renderMarkdown(`## ${foundValue.label} Rules\n${foundValue.rules}`)); } } diff --git a/src/ui/Settings.tsx b/src/ui/Settings.tsx index abba6e8..c32ab9b 100644 --- a/src/ui/Settings.tsx +++ b/src/ui/Settings.tsx @@ -9,6 +9,8 @@ import { UrlCache } from "../util/UrlCache"; import { openFileAsArrayBuffer } from "../util/FileUtil"; import * as FontList from "../util/FontList"; +import "../css/Tooltip.scss"; + export interface Props { context: string, setValue: (index: number, value: T) => void, @@ -23,6 +25,7 @@ export interface ExtendedSettingsDescriptionJson { export interface ExtendedSettingsDescriptionFieldJson { text: string, + tooltip: string, value: ExtendedSettingsDescriptionValueJson, } @@ -1351,7 +1354,10 @@ export class SettingsComponent extends React.Component> { settingsRows.push( - {field.text} + + {field.text} + {field.tooltip} + {component} , ); diff --git a/tsconfig.json b/tsconfig.json index ba80e74..e95a508 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "sourceMap": true, "noImplicitAny": true, "module": "ESNext", - "target": "ES2018", + "target": "ES2022", "jsx": "react", "strictNullChecks": true, "noImplicitReturns": true, @@ -17,7 +17,7 @@ "allowSyntheticDefaultImports": true, "moduleResolution": "Node", "lib": [ - "ES2018", + "ES2022", "DOM" ] },