A few client fixes
parent
a8c8286b88
commit
2e352f383e
|
@ -40,29 +40,27 @@ export class NotificationsViewItemModel
|
||||||
|
|
||||||
get isLike() {
|
get isLike() {
|
||||||
return (
|
return (
|
||||||
hasProp(this.record, '$type') &&
|
hasProp(this.record, '$type') && this.record.$type === 'todo.social.like'
|
||||||
this.record.$type === 'blueskyweb.xyz:Like'
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRepost() {
|
get isRepost() {
|
||||||
return (
|
return (
|
||||||
hasProp(this.record, '$type') &&
|
hasProp(this.record, '$type') &&
|
||||||
this.record.$type === 'blueskyweb.xyz:Repost'
|
this.record.$type === 'todo.social.repost'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
get isReply() {
|
get isReply() {
|
||||||
return (
|
return (
|
||||||
hasProp(this.record, '$type') &&
|
hasProp(this.record, '$type') && this.record.$type === 'todo.social.post'
|
||||||
this.record.$type === 'blueskyweb.xyz:Post'
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
get isFollow() {
|
get isFollow() {
|
||||||
return (
|
return (
|
||||||
hasProp(this.record, '$type') &&
|
hasProp(this.record, '$type') &&
|
||||||
this.record.$type === 'blueskyweb.xyz:Follow'
|
this.record.$type === 'todo.social.follow'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {makeAutoObservable} from 'mobx'
|
import {makeAutoObservable} from 'mobx'
|
||||||
import AdxApi, {ServiceClient} from '../../third-party/api'
|
import AdxApi from '../../third-party/api'
|
||||||
|
import {ServiceClient} from '../../third-party/api/src/index'
|
||||||
import {createContext, useContext} from 'react'
|
import {createContext, useContext} from 'react'
|
||||||
import {isObj, hasProp} from '../lib/type-guards'
|
import {isObj, hasProp} from '../lib/type-guards'
|
||||||
import {SessionModel} from './session'
|
import {SessionModel} from './session'
|
||||||
|
@ -27,11 +28,14 @@ export class RootStoreModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async resolveName(didOrName: string) {
|
async resolveName(didOrName: string) {
|
||||||
throw new Error('TODO')
|
if (!didOrName) {
|
||||||
return ''
|
throw new Error('Invalid name: ""')
|
||||||
// const userDb = this.api.mockDb.getUser(didOrName)
|
}
|
||||||
// if (!userDb) throw new Error(`User not found: ${didOrName}`)
|
if (didOrName.startsWith('did:')) {
|
||||||
// return userDb.did
|
return didOrName
|
||||||
|
}
|
||||||
|
const res = await this.api.todo.adx.resolveName({name: didOrName})
|
||||||
|
return res.data.did
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize(): unknown {
|
serialize(): unknown {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {useStores} from '../../state'
|
||||||
export const PostLikedBy = ({visible, params}: ScreenParams) => {
|
export const PostLikedBy = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, recordKey} = params
|
||||||
const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey)
|
const uri = makeRecordUri(name, 'todo.social.post', recordKey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {useStores} from '../../state'
|
||||||
export const PostRepostedBy = ({visible, params}: ScreenParams) => {
|
export const PostRepostedBy = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, recordKey} = params
|
||||||
const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey)
|
const uri = makeRecordUri(name, 'todo.social.post', recordKey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {useStores} from '../../state'
|
||||||
export const PostThread = ({visible, params}: ScreenParams) => {
|
export const PostThread = ({visible, params}: ScreenParams) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {name, recordKey} = params
|
const {name, recordKey} = params
|
||||||
const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey)
|
const uri = makeRecordUri(name, 'todo.social.post', recordKey)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
Loading…
Reference in New Issue