From 2fe7bc745b510faecafbfa8d911ca3acb0870ec5 Mon Sep 17 00:00:00 2001 From: skarab42 Date: Sun, 28 Feb 2021 20:10:48 +0100 Subject: [PATCH 1/2] feat: Change edit message --- .../components/Panels/Panel/Widget/Button.svelte | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/front-src/client/components/Panels/Panel/Widget/Button.svelte b/front-src/client/components/Panels/Panel/Widget/Button.svelte index ad902fea..6560f902 100644 --- a/front-src/client/components/Panels/Panel/Widget/Button.svelte +++ b/front-src/client/components/Panels/Panel/Widget/Button.svelte @@ -32,14 +32,9 @@ {#if $editMode} {#if !component} -
-
- -
-
- {_('sentences.double-click-to-edit')} +
+
+ {_('sentences.right-click-to-show-menu')}
{/if} From 4f953d54f9ea8d535c7caa8ecfe84f7b5dd53337 Mon Sep 17 00:00:00 2001 From: skarab42 Date: Sun, 28 Feb 2021 21:10:36 +0100 Subject: [PATCH 2/2] feat: Set widget min size when selected --- app/static/locales/en/app.json | 2 +- app/static/locales/es/app.json | 2 +- app/static/locales/fr/app.json | 2 +- .../Panels/Panel/Widget/Edit/Action.svelte | 16 ++++++++++++++++ .../components/Widgets/Anime/Timeline/config.js | 4 ++++ .../components/Widgets/OBS/GoToScene/config.js | 4 ++++ .../components/Widgets/OBS/SceneList/config.js | 4 ++++ .../components/Widgets/OBS/ToggleAudio/config.js | 4 ++++ .../components/Widgets/OBS/ToggleScene/config.js | 4 ++++ .../components/Widgets/Twitch/Chat/config.js | 4 ++++ .../components/Widgets/Twitch/Commands/config.js | 4 ++++ .../Widgets/Twitch/Followers/config.js | 4 ++++ .../components/Widgets/Twitch/Rewards/config.js | 4 ++++ .../components/Widgets/Twitch/Stream/config.js | 4 ++++ 14 files changed, 59 insertions(+), 3 deletions(-) diff --git a/app/static/locales/en/app.json b/app/static/locales/en/app.json index 63b5d7bd..17b0de38 100644 --- a/app/static/locales/en/app.json +++ b/app/static/locales/en/app.json @@ -175,7 +175,7 @@ "check-disable-source-not-visible": "Check: Shutdown source when not visible.", "check-refresh-browser-on-activate": "Check: Refresh browser when scene becomes active.", "overlay-not-found": "Overlay not found", - "no-source-selected": "obs.no-source-selected" + "no-source-selected": "No source selected" }, "anime": { "timeline": "Animation" diff --git a/app/static/locales/es/app.json b/app/static/locales/es/app.json index f1f803e1..b046a524 100644 --- a/app/static/locales/es/app.json +++ b/app/static/locales/es/app.json @@ -174,7 +174,7 @@ "check-disable-source-not-visible": "Marque la casilla: Desactivar la fuente en la que no este visible.", "check-refresh-browser-on-activate": "Marque la casilla: Recargar el navegador cuando la escena sea activa.", "overlay-not-found": "Overlay no encontrado", - "no-source-selected": "obs.no-source-selected" + "no-source-selected": "No se seleccionó ninguna fuente" }, "anime": { "timeline": "Animación" diff --git a/app/static/locales/fr/app.json b/app/static/locales/fr/app.json index e04df3e6..ca30764d 100644 --- a/app/static/locales/fr/app.json +++ b/app/static/locales/fr/app.json @@ -175,7 +175,7 @@ "check-disable-source-not-visible": "Coche la case: Désactiver la source quand elle n'est pas visible.", "check-refresh-browser-on-activate": "Coche la case: Rafraîchir le navigateur lorsque la scène devient active.", "overlay-not-found": "Overlay non trouvé", - "no-source-selected": "obs.no-source-selected" + "no-source-selected": "Aucune source sélectionnée" }, "anime": { "timeline": "Animation" diff --git a/front-src/client/components/Panels/Panel/Widget/Edit/Action.svelte b/front-src/client/components/Panels/Panel/Widget/Edit/Action.svelte index fc88a236..39bc3f38 100644 --- a/front-src/client/components/Panels/Panel/Widget/Edit/Action.svelte +++ b/front-src/client/components/Panels/Panel/Widget/Edit/Action.svelte @@ -13,6 +13,7 @@ import ActionEvents from "./ActionEvents.svelte"; import Button from "@/components/UI/Button.svelte"; import Select from "@/components/UI/Select.svelte"; + import { findSpaceForWidget } from "@/stores/panels"; import MdDelete from "svelte-icons/md/MdDeleteForever.svelte"; import ConfirmModal from "@/components/UI/ConfirmModal.svelte"; @@ -58,6 +59,21 @@ } function onComponentChange({ detail: name }) { + const { minSize } = widgets[name].config; + + if (minSize) { + let oldSpace = {}; + panel.grid = panel.grid.filter((space) => { + if (space.id === widget.id) { + oldSpace = space; + return false; + } + return true; + }); + const space = findSpaceForWidget(panel, minSize); + panel.grid = [...panel.grid, { ...oldSpace, ...space }]; + } + change("component", cloneDeep(widgets[name].config)); } diff --git a/front-src/client/components/Widgets/Anime/Timeline/config.js b/front-src/client/components/Widgets/Anime/Timeline/config.js index 61a33dca..16d7fc8b 100644 --- a/front-src/client/components/Widgets/Anime/Timeline/config.js +++ b/front-src/client/components/Widgets/Anime/Timeline/config.js @@ -3,5 +3,9 @@ export default { label: "anime.timeline", hasTrigger: true, hasEvent: true, + minSize: { + w: 2, + h: 4, + }, props: {}, }; diff --git a/front-src/client/components/Widgets/OBS/GoToScene/config.js b/front-src/client/components/Widgets/OBS/GoToScene/config.js index e3079b44..8e737396 100644 --- a/front-src/client/components/Widgets/OBS/GoToScene/config.js +++ b/front-src/client/components/Widgets/OBS/GoToScene/config.js @@ -3,6 +3,10 @@ export default { label: "obs.go-to-scene", hasTrigger: true, hasEvent: true, + minSize: { + w: 2, + h: 4, + }, props: { scene: null, }, diff --git a/front-src/client/components/Widgets/OBS/SceneList/config.js b/front-src/client/components/Widgets/OBS/SceneList/config.js index 6821090e..6a04004b 100644 --- a/front-src/client/components/Widgets/OBS/SceneList/config.js +++ b/front-src/client/components/Widgets/OBS/SceneList/config.js @@ -3,4 +3,8 @@ export default { label: "obs.scene-list", hasTrigger: true, hasEvent: ["onCommand"], + minSize: { + w: 2, + h: 4, + }, }; diff --git a/front-src/client/components/Widgets/OBS/ToggleAudio/config.js b/front-src/client/components/Widgets/OBS/ToggleAudio/config.js index c84ca69d..33931428 100644 --- a/front-src/client/components/Widgets/OBS/ToggleAudio/config.js +++ b/front-src/client/components/Widgets/OBS/ToggleAudio/config.js @@ -3,6 +3,10 @@ export default { label: "obs.toggle-audio", hasTrigger: true, hasEvent: true, + minSize: { + w: 2, + h: 4, + }, props: { source: null, }, diff --git a/front-src/client/components/Widgets/OBS/ToggleScene/config.js b/front-src/client/components/Widgets/OBS/ToggleScene/config.js index ac1903b3..a5f15bb7 100644 --- a/front-src/client/components/Widgets/OBS/ToggleScene/config.js +++ b/front-src/client/components/Widgets/OBS/ToggleScene/config.js @@ -3,6 +3,10 @@ export default { label: "obs.toggle-scene", hasTrigger: true, hasEvent: true, + minSize: { + w: 2, + h: 4, + }, props: { scene1: null, scene2: null, diff --git a/front-src/client/components/Widgets/Twitch/Chat/config.js b/front-src/client/components/Widgets/Twitch/Chat/config.js index 7810fa26..58f4df1f 100644 --- a/front-src/client/components/Widgets/Twitch/Chat/config.js +++ b/front-src/client/components/Widgets/Twitch/Chat/config.js @@ -3,6 +3,10 @@ export default { label: "twitch.chat", hasTrigger: false, hasEvent: false, + minSize: { + w: 3, + h: 8, + }, props: { channel: null, theme: "dark", diff --git a/front-src/client/components/Widgets/Twitch/Commands/config.js b/front-src/client/components/Widgets/Twitch/Commands/config.js index 8f7e92f7..1888dcce 100644 --- a/front-src/client/components/Widgets/Twitch/Commands/config.js +++ b/front-src/client/components/Widgets/Twitch/Commands/config.js @@ -3,4 +3,8 @@ export default { label: "twitch.commands", hasTrigger: false, hasEvent: false, + minSize: { + w: 3, + h: 4, + }, }; diff --git a/front-src/client/components/Widgets/Twitch/Followers/config.js b/front-src/client/components/Widgets/Twitch/Followers/config.js index 8f2bcce5..9aae15f5 100644 --- a/front-src/client/components/Widgets/Twitch/Followers/config.js +++ b/front-src/client/components/Widgets/Twitch/Followers/config.js @@ -3,4 +3,8 @@ export default { label: "twitch.followers", hasTrigger: false, hasEvent: false, + minSize: { + w: 3, + h: 4, + }, }; diff --git a/front-src/client/components/Widgets/Twitch/Rewards/config.js b/front-src/client/components/Widgets/Twitch/Rewards/config.js index 134d0c4f..910ceb13 100644 --- a/front-src/client/components/Widgets/Twitch/Rewards/config.js +++ b/front-src/client/components/Widgets/Twitch/Rewards/config.js @@ -3,4 +3,8 @@ export default { label: "twitch.rewards", hasTrigger: false, hasEvent: false, + minSize: { + w: 3, + h: 4, + }, }; diff --git a/front-src/client/components/Widgets/Twitch/Stream/config.js b/front-src/client/components/Widgets/Twitch/Stream/config.js index 04ebe9d8..6b482a8e 100644 --- a/front-src/client/components/Widgets/Twitch/Stream/config.js +++ b/front-src/client/components/Widgets/Twitch/Stream/config.js @@ -3,6 +3,10 @@ export default { label: "twitch.stream", hasTrigger: false, hasEvent: false, + minSize: { + w: 3, + h: 4, + }, props: { channel: null, autoplay: true,