Add username props to user timeline component
This commit is contained in:
parent
212cea2b59
commit
d3f5313bd8
|
@ -23,6 +23,8 @@ import { Component, Prop, Vue } from "vue-property-decorator"
|
|||
|
||||
@Component
|
||||
export default class UserTimeline extends Vue {
|
||||
@Prop() public username!: string
|
||||
|
||||
public timelineType: string = 'home'
|
||||
public userTimelineTypes: {
|
||||
[key: string]: string
|
||||
|
|
|
@ -22,7 +22,16 @@
|
|||
<script lang="ts">
|
||||
import { ipcRenderer } from "electron"
|
||||
import { Component, Vue } from "vue-property-decorator"
|
||||
|
||||
type Instance = string
|
||||
interface Account {
|
||||
domain: string
|
||||
acct: string
|
||||
avatar: string
|
||||
avatarStatic: string
|
||||
accessToken?: string
|
||||
}
|
||||
|
||||
@Component
|
||||
export default class AccountAuth extends Vue {
|
||||
public instance: Instance = ""
|
||||
|
@ -44,8 +53,8 @@ export default class AccountAuth extends Vue {
|
|||
this.instance = ''
|
||||
ipcRenderer.once(
|
||||
`login-complete`,
|
||||
(e: Event) => {
|
||||
this.$emit('login-complete')
|
||||
(e: Event, account: Account) => {
|
||||
this.$emit('login-complete', account)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
>
|
||||
<Login v-if="status === 'login'" @login-complete="loggedIn"/>
|
||||
<PublicTimeline v-else-if="status === 'public_timeline'"/>
|
||||
<Timeline v-else-if="status === 'select_timeline'"/>
|
||||
<UserTimeline v-else-if="status === 'select_timeline'" :username="username"/>
|
||||
</BaseOverlay>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -27,25 +27,35 @@
|
|||
import { Component, Vue } from 'vue-property-decorator'
|
||||
|
||||
import Login from './Preferences/AccountAuth.vue'
|
||||
import Timeline from './AddColumn/UserTimeline.vue'
|
||||
import UserTimeline from './AddColumn/UserTimeline.vue'
|
||||
import PublicTimeline from './AddColumn/PublicTimeline.vue'
|
||||
|
||||
type Status = 'welcome' | 'login' | 'public_timeline' | 'select_timeline'
|
||||
interface Account {
|
||||
domain: string
|
||||
acct: string
|
||||
avatar: string
|
||||
avatarStatic: string
|
||||
accessToken?: string
|
||||
}
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Login,
|
||||
Timeline,
|
||||
UserTimeline,
|
||||
PublicTimeline,
|
||||
}
|
||||
})
|
||||
export default class Welcome extends Vue {
|
||||
public status: Status = 'welcome'
|
||||
public loginButton: string = 'Login'
|
||||
public publicTLButton: string = 'Streaming Public Timeline'
|
||||
public selectTimeline: string = 'Select Timeline'
|
||||
|
||||
public loggedIn() {
|
||||
public username: string = ''
|
||||
public status: Status = 'welcome'
|
||||
|
||||
public loggedIn(account: Account) {
|
||||
this.username = `@${account.acct}@${account.domain}`
|
||||
this.status = 'select_timeline'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export default class Auth {
|
|||
autoload: true
|
||||
})
|
||||
let docs = {
|
||||
domain: url,
|
||||
domain: instance,
|
||||
acct: you.acct,
|
||||
avatar: you.avatar,
|
||||
avatarStatic: you.avatar_static,
|
||||
|
@ -82,7 +82,7 @@ export default class Auth {
|
|||
message: "You cannot login already logined account."
|
||||
})
|
||||
} else {
|
||||
event.sender.send(`login-complete`)
|
||||
event.sender.send(`login-complete`, newDocs)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user