diff --git a/Docs/Schemas/ExtraLinkConfigJson.schema.json b/Docs/Schemas/ExtraLinkConfigJson.schema.json new file mode 100644 index 000000000..9d232d1f2 --- /dev/null +++ b/Docs/Schemas/ExtraLinkConfigJson.schema.json @@ -0,0 +1,66 @@ +{ + "type": "object", + "properties": { + "icon": { + "type": "string" + }, + "text": {}, + "href": { + "type": "string" + }, + "newTab": { + "type": "boolean" + }, + "requirements": { + "type": "array", + "items": { + "enum": [ + "iframe", + "no-iframe", + "no-welcome-message", + "welcome-message" + ], + "type": "string" + } + } + }, + "required": [ + "href" + ], + "definitions": { + "AndOrTagConfigJson": { + "type": "object", + "properties": { + "and": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/AndOrTagConfigJson" + }, + { + "type": "string" + } + ] + } + }, + "or": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/AndOrTagConfigJson" + }, + { + "type": "string" + } + ] + } + } + }, + "additionalProperties": false + } + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false +} \ No newline at end of file diff --git a/Docs/Schemas/ExtraLinkConfigJsonJSC.ts b/Docs/Schemas/ExtraLinkConfigJsonJSC.ts new file mode 100644 index 000000000..b3175e1c4 --- /dev/null +++ b/Docs/Schemas/ExtraLinkConfigJsonJSC.ts @@ -0,0 +1,64 @@ +export default { + "type": "object", + "properties": { + "icon": { + "type": "string" + }, + "text": {}, + "href": { + "type": "string" + }, + "newTab": { + "type": "boolean" + }, + "requirements": { + "type": "array", + "items": { + "enum": [ + "iframe", + "no-iframe", + "no-welcome-message", + "welcome-message" + ], + "type": "string" + } + } + }, + "required": [ + "href" + ], + "definitions": { + "AndOrTagConfigJson": { + "type": "object", + "properties": { + "and": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/AndOrTagConfigJson" + }, + { + "type": "string" + } + ] + } + }, + "or": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/AndOrTagConfigJson" + }, + { + "type": "string" + } + ] + } + } + } + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} \ No newline at end of file diff --git a/UI/BigComponents/ExtraLinkButton.ts b/UI/BigComponents/ExtraLinkButton.ts index 3de7aa6b2..4d7c6e06c 100644 --- a/UI/BigComponents/ExtraLinkButton.ts +++ b/UI/BigComponents/ExtraLinkButton.ts @@ -64,7 +64,7 @@ export default class ExtraLinkButton extends UIElement{ link = new SubtleButton(img,c.text, {url: href, - newTab: c.newTab}).SetClass("w-64 block") + newTab: c.newTab}) } if(c.requirements.has("no-welcome-message")){ diff --git a/UI/DefaultGUI.ts b/UI/DefaultGUI.ts index 199311207..7a9786787 100644 --- a/UI/DefaultGUI.ts +++ b/UI/DefaultGUI.ts @@ -159,24 +159,25 @@ export default class DefaultGUI { const guiState = this._guiState; const self = this - Toggle.If(state.featureSwitchUserbadge, - () => new UserBadge(state) - ).AttachTo("userbadge") + new Combine([ + Toggle.If(state.featureSwitchUserbadge, + () => new UserBadge(state) + ), + Toggle.If(state.featureSwitchExtraLinkEnabled, + () => new ExtraLinkButton(state, state.layoutToUse.extraLink) + ) + ]).SetClass("flex flex-col") + .AttachTo("userbadge") Toggle.If(state.featureSwitchSearch, () => new SearchAndGo(state)) .AttachTo("searchbox"); - new Combine([ - Toggle.If(state.featureSwitchExtraLinkEnabled, - () => new ExtraLinkButton(state, state.layoutToUse.extraLink).SetClass("pointer-events-auto") - ) - , - Toggle.If( - state.featureSwitchWelcomeMessage, - () => self.InitWelcomeMessage() - )]) - .SetClass("flex flex-col") + + Toggle.If( + state.featureSwitchWelcomeMessage, + () => self.InitWelcomeMessage() + ) .AttachTo("messagesbox");