member id instead of whole object in state.

This commit is contained in:
Miroslav Šedivý 2020-12-01 23:59:02 +01:00
parent 4c247f61ff
commit a268bddc57
2 changed files with 8 additions and 23 deletions

View File

@ -6,7 +6,7 @@
:webrtc="webrtc"
:screenWidth="state.screen.size.width"
:screenHeight="state.screen.size.height"
:isControling="state.member.is_controlling"
:isControling="controlling"
:scrollSensitivity="state.control.scroll.sensitivity"
:scrollInvert="state.control.scroll.inverse"
/>
@ -94,7 +94,7 @@
sensitivity: 1,
},
clipboard: null,
host: null,
host_id: null,
},
screen: {
size: {
@ -104,16 +104,7 @@
},
configurations: [],
},
member: {
id: null,
name: null,
is_admin: false,
is_watching: false,
is_controlling: false,
can_watch: false,
can_control: false,
clipboard_access: false,
},
member_id: null,
members: {},
} as NekoState
@ -122,7 +113,7 @@
}
public get controlling() {
return this.state.member.is_controlling
return this.state.control.host_id !== null && this.state.member_id === this.state.control.host_id
}
/////////////////////////////
@ -325,12 +316,6 @@
this.websocket.disconnect()
}
@Watch('state.video.playing')
onVideoPlayingChanged(play: boolean) {
// TODO: check if user has tab focused and send via websocket
Vue.set(this.state.member, 'is_watching', play)
}
@Watch('state.screen.size')
onResize() {
const { width, height } = this.state.screen.size

View File

@ -3,7 +3,7 @@ export default interface State {
video: Video
control: Control
screen: Screen
member: Member
member_id: string | null
members: Record<string, Member>
}
@ -36,7 +36,7 @@ export interface Video {
export interface Control {
scroll: Scroll
clipboard: Clipboard | null
host: Member | null
host_id: string | null
}
export interface Scroll {
@ -66,8 +66,8 @@ export interface ScreenSize {
// Member
/////////////////////////////
export interface Member {
id: string | null
name: string | null
id: string
name: string
is_admin: boolean
is_watching: boolean
is_controlling: boolean