Skip to content

Commit a341a19

Browse files
nnhathungkhangonntthitrinh
authored
Feature-9082: Enhance language dropdown button (#9131)
* feature-9082: Enhance language dropdown button * feature-9082: Enhance language dropdown button * fix css * fix UI * fix missing header * fix missing header * fix missing header * fix missing header * fix missing header * fix missing header * avoid using css inline * feature-9082: Fix css dropdown side panel * feature-9082: Fix css dropdown side panel * feature-9082: Fix css dropdown side panel * fix-9082 language dropdown not showing up * fix-9082 language dropdown not showing up --------- Co-authored-by: Khang On - TMA <[email protected]> Co-authored-by: ntthitrinh <[email protected]>
1 parent f04f570 commit a341a19

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

app/components/public/stream/side-panel.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<div class="chat-video-room">
6060
<div>
6161
<div class="ui inverted vertical fluid menu borderless stream-side-menu">
62-
{{#each this.streams as |stream|}}
62+
{{#each this.streamList as |stream|}}
6363
<a href={{href-to 'public.stream.view' @event stream.slugName stream.id }} class="{{if (eq @currentRoom.microlocationId stream.microlocationId) 'video-active'}} item stream-item d-flex items-center" {{on "click" (fn @setupRoomChat stream) }} >
6464
<span class="stream-preview-letter" style={{css background-color=(object-at (abs (mod stream.hash this.colors.length)) this.colors)}}>{{truncate (uppercase stream.name) 1 false}}</span>
6565
<span class="ml-2">{{stream.name}}</span>

app/components/public/stream/side-panel.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class PublicStreamSidePanel extends Component<Args> {
4646
@tracked showChat = false;
4747
@tracked showRoomChat = false;
4848
@tracked showVideoRoom = false;
49+
@tracked languageList: any = [];
4950

5051
@tracked translationChannels = [{
5152
id : '0',
@@ -147,14 +148,22 @@ export default class PublicStreamSidePanel extends Component<Args> {
147148
isGlobalEventRoom : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.attributes['is-global-event-room'])[0],
148149
chatRoomName : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.attributes['chat-room-name'])[0],
149150
microlocationId : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.id)[0],
150-
hash : stringHashCode(stream.attributes.name + stream.id)
151-
})).forEach(async(stream: any) => {
151+
hash : stringHashCode(stream.attributes.name + stream.id),
152+
translations : []
153+
})).forEach((stream: any) => {
152154
this.addStream(stream)
153155
});
154-
this.streams.forEach(async(stream: any) => {
155-
const res = await this.fetchTranslationChannels(stream.id)
156-
stream.translations = res
157-
});
156+
const languageLists: any = [];
157+
Promise.all(this.streams.map(async(stream: any) => {
158+
const res = await this.fetchTranslationChannels(stream.id);
159+
const item = {
160+
streamId: stream.id
161+
}
162+
languageLists.push(item);
163+
stream.translations = res;
164+
})).then(() => {
165+
this.languageList = languageLists;
166+
})
158167
} catch (e) {
159168
console.error('Error while loading rooms in video stream', e);
160169
}
@@ -174,4 +183,9 @@ export default class PublicStreamSidePanel extends Component<Args> {
174183
this.loading = false;
175184
this.streams = [...this.streams];
176185
}
186+
187+
@computed('[email protected]')
188+
get streamList() {
189+
return this.streams;
190+
}
177191
}

app/models/video-stream.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default class VideoStream extends ModelBase.extend() {
3535
@attr() additionalInformation!: string;
3636
@attr() extra!: Extra;
3737
@attr() chatRoomName?: string;
38+
@attr() translations?: any[];
3839

3940
@hasMany('microlocation') rooms!: Microlocation[];
4041
@hasMany('video-recording') videoRecordings!: VideoRecording[];

0 commit comments

Comments
 (0)