From 2ae1b25f99f20e1e5d46102e70f7f33db3b9086f Mon Sep 17 00:00:00 2001 From: nnhathung Date: Mon, 14 Aug 2023 19:40:26 +0700 Subject: [PATCH 01/18] feature-9082: Enhance language dropdown button --- app/components/public/stream/side-panel.hbs | 41 +++++++------ app/components/public/stream/side-panel.ts | 10 +++- app/services/selecting-language.js | 11 ++++ .../components/translation-dropdown.scss | 60 +++++++++++++------ 4 files changed, 85 insertions(+), 37 deletions(-) diff --git a/app/components/public/stream/side-panel.hbs b/app/components/public/stream/side-panel.hbs index 670ecba4882..2bc39283942 100644 --- a/app/components/public/stream/side-panel.hbs +++ b/app/components/public/stream/side-panel.hbs @@ -66,25 +66,32 @@ {{stream.name}} {{#if (gt stream.translations.length 1)}}
-
+
-
-
- -
-
- {{stream.translations.length}} {{t 'languages'}} -
-
- -
-
+ @selected={{this.selectingLanguage.getName}} + @onChange={{ action "switchLanguage"}} as |execute mapper|> +
+ {{#if this.language}} +
+ {{this.language}} +
+ {{else}} +
+ +
+
+ {{stream.translations.length}} +
+ {{/if}} +
+ +
+
diff --git a/app/components/public/stream/side-panel.ts b/app/components/public/stream/side-panel.ts index 227baf29b08..d8f73c842b3 100644 --- a/app/components/public/stream/side-panel.ts +++ b/app/components/public/stream/side-panel.ts @@ -46,6 +46,7 @@ export default class PublicStreamSidePanel extends Component { @tracked showChat = false; @tracked showRoomChat = false; @tracked showVideoRoom = false; + @tracked language = null; @tracked translationChannels = [{ id : '0', @@ -109,9 +110,14 @@ export default class PublicStreamSidePanel extends Component { } @action - switchLanguage(url: string): void { - this.selectingLanguage.setLanguage(url); + switchLanguage(channel: any): void { + this.selectingLanguage.setLanguage(channel.url); this.selectingLanguage.updateTranslationYTId(); + this.selectingLanguage.setName(channel.name); + this.language = this.selectingLanguage.getName(); + if (this.selectingLanguage.getName() === 'Original') { + this.language = null + } } @action diff --git a/app/services/selecting-language.js b/app/services/selecting-language.js index 62224ff29e0..cdb3943bbaf 100644 --- a/app/services/selecting-language.js +++ b/app/services/selecting-language.js @@ -5,6 +5,9 @@ export default class SelectingLanguageService extends Service { @tracked selectingLanguage = null; + @tracked + name = null; + @tracked isStreamYardVisible = true; @@ -16,6 +19,10 @@ export default class SelectingLanguageService extends Service { this.isStreamYardVisible = true; } + setName(name) { + this.name = name; + } + setStreamYardVisibility(isVisible) { this.isStreamYardVisible = isVisible; } @@ -32,4 +39,8 @@ export default class SelectingLanguageService extends Service { getLanguage() { return this.selectingLanguage; } + + getName() { + return this.name; + } } diff --git a/app/styles/components/translation-dropdown.scss b/app/styles/components/translation-dropdown.scss index 7c0d4715a44..568af969610 100644 --- a/app/styles/components/translation-dropdown.scss +++ b/app/styles/components/translation-dropdown.scss @@ -1,15 +1,30 @@ .translation-dropdown-container { - height: 3rem; + height: 2.5rem; + width: 135.5px !important; display: flex; justify-content: space-between; align-items: center; + + .menu.transition.visible { + font-size: small !important; + color: #808080 !important; + padding-left: 5px !important; + transform: translateX(-10.7%); + animation: slideInMenu .3s forwards; + top: 22px !important; + border-top-left-radius: unset; + border-top-right-radius: unset; + border-bottom-right-radius: .285714rem; + border-bottom-left-radius: .285714rem; + } + } .translation-dropdown-wrapper { - display: flex; - justify-content: space-between; align-items: center; flex: 1; + display: flex; + width: 107.5px; } .translation-dropdown { @@ -24,6 +39,21 @@ .translation-dropdown-component { display: inline-block; + + i.translation.icon { + font-size: 1.8em; + color: #808080; + } +} + +.translation-dropdown-language { + font-size: .8em; + margin-left: 5px; + background-color: #808080; + border-radius: 100%; + color: #fff; + padding: 2px 5px; + margin-top: 1px; } .translation-dropdown .ui.dropdown { @@ -33,20 +63,8 @@ padding: 8px; } -.translation-dropdown .ui.dropdown .menu { - background-color: #f9f9f9; -} - -.translation-dropdown .ui.dropdown .item { - color: #333; -} - -.translation-dropdown .ui.dropdown i.dropdown.icon { - color: #333; -} - .translation-dropdown-button { - width: 9.6rem; + width: 5rem; border-radius: .28571429rem; border-top-left-radius: .285714rem; border-top-right-radius: .285714rem; @@ -69,12 +87,18 @@ cursor: default; box-sizing: border-box; background-color: buttonface; - padding: 1px 6px; + padding: 1px 20px; border-image: initial; } .translation.menu { left: -6px !important; margin-top: 10px !important; - width: 9.6rem !important; + width: 5rem !important; + + .item { + font-size: small !important; + color: #808080 !important; + padding-left: 5px !important; + } } From ea82eaf98a530536bd5aad2b9ac54dd8bda4b102 Mon Sep 17 00:00:00 2001 From: nnhathung Date: Mon, 14 Aug 2023 19:41:07 +0700 Subject: [PATCH 02/18] feature-9082: Enhance language dropdown button --- app/styles/components/translation-dropdown.scss | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/styles/components/translation-dropdown.scss b/app/styles/components/translation-dropdown.scss index 568af969610..7d21e3e85f5 100644 --- a/app/styles/components/translation-dropdown.scss +++ b/app/styles/components/translation-dropdown.scss @@ -41,18 +41,18 @@ display: inline-block; i.translation.icon { - font-size: 1.8em; + font-size: 1.8em; color: #808080; } } .translation-dropdown-language { - font-size: .8em; - margin-left: 5px; - background-color: #808080; - border-radius: 100%; - color: #fff; - padding: 2px 5px; + font-size: .8em; + margin-left: 5px; + background-color: #808080; + border-radius: 100%; + color: #fff; + padding: 2px 5px; margin-top: 1px; } From bce4e15e55503e63944c4120b0024fd9fd660e78 Mon Sep 17 00:00:00 2001 From: nnhathung Date: Mon, 14 Aug 2023 21:39:23 +0700 Subject: [PATCH 03/18] fix css --- app/components/public/stream/side-panel.hbs | 4 +--- app/styles/components/translation-dropdown.scss | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/components/public/stream/side-panel.hbs b/app/components/public/stream/side-panel.hbs index 2bc39283942..2d5bb3fdbb5 100644 --- a/app/components/public/stream/side-panel.hbs +++ b/app/components/public/stream/side-panel.hbs @@ -66,8 +66,7 @@ {{stream.name}} {{#if (gt stream.translations.length 1)}}
-
-
@@ -94,7 +93,6 @@ {{/each}}
-
{{/if}} diff --git a/app/styles/components/translation-dropdown.scss b/app/styles/components/translation-dropdown.scss index 7d21e3e85f5..196f5742941 100644 --- a/app/styles/components/translation-dropdown.scss +++ b/app/styles/components/translation-dropdown.scss @@ -1,7 +1,7 @@ .translation-dropdown-container { height: 2.5rem; width: 135.5px !important; - display: flex; + display: flex !important; justify-content: space-between; align-items: center; @@ -38,7 +38,7 @@ } .translation-dropdown-component { - display: inline-block; + display: flex; i.translation.icon { font-size: 1.8em; @@ -92,8 +92,8 @@ } .translation.menu { - left: -6px !important; - margin-top: 10px !important; + left: 14px !important; + margin-top: 18px !important; width: 5rem !important; .item { From 6df3e9c9c7e44598b98e0b159a067d694b104d8a Mon Sep 17 00:00:00 2001 From: nnhathung Date: Tue, 15 Aug 2023 18:19:37 +0700 Subject: [PATCH 04/18] fix UI --- app/components/public/stream/side-panel.hbs | 22 ++++----- app/components/public/stream/side-panel.ts | 11 +++-- app/services/selecting-language.js | 15 +++++- .../components/translation-dropdown.scss | 49 +++++++++++++------ 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/app/components/public/stream/side-panel.hbs b/app/components/public/stream/side-panel.hbs index 2d5bb3fdbb5..4b0fd421cec 100644 --- a/app/components/public/stream/side-panel.hbs +++ b/app/components/public/stream/side-panel.hbs @@ -60,7 +60,7 @@