diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-12-14 15:35:15 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-12-14 15:35:15 -0600 |
commit | 4966b2152eb213bac34cbcb0ff01c246b7746f5c (patch) | |
tree | 5cc90408631c984018f1b5a4b06f428d3d31d4a5 /src/state/models | |
parent | 345ec83f26e209929ca86b3885227e8508fb2cb8 (diff) | |
download | voidsky-4966b2152eb213bac34cbcb0ff01c246b7746f5c.tar.zst |
Add post embeds (images and external links)
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/feed-view.ts | 2 | ||||
-rw-r--r-- | src/state/models/post-thread-view.ts | 3 | ||||
-rw-r--r-- | src/state/models/shell-ui.ts | 11 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index 75ed82684..503e2a4c6 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -49,6 +49,7 @@ export class FeedItemModel implements GetTimeline.FeedItem { repostedBy?: ActorRef.WithInfo trendedBy?: ActorRef.WithInfo record: Record<string, unknown> = {} + embed?: GetTimeline.FeedItem['embed'] replyCount: number = 0 repostCount: number = 0 upvoteCount: number = 0 @@ -78,6 +79,7 @@ export class FeedItemModel implements GetTimeline.FeedItem { this.repostedBy = v.repostedBy this.trendedBy = v.trendedBy this.record = v.record + this.embed = v.embed this.replyCount = v.replyCount this.repostCount = v.repostCount this.upvoteCount = v.upvoteCount diff --git a/src/state/models/post-thread-view.ts b/src/state/models/post-thread-view.ts index a71587d87..ea9d123d0 100644 --- a/src/state/models/post-thread-view.ts +++ b/src/state/models/post-thread-view.ts @@ -1,6 +1,5 @@ import {makeAutoObservable, runInAction} from 'mobx' import {AppBskyFeedGetPostThread as GetPostThread} from '../../third-party/api' -import * as Embed from '../../third-party/api/src/client/types/app/bsky/feed/embed' import * as ActorRef from '../../third-party/api/src/client/types/app/bsky/actor/ref' import {AtUri} from '../../third-party/uri' import _omit from 'lodash.omit' @@ -60,7 +59,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post { declaration: {cid: '', actorType: ''}, } record: Record<string, unknown> = {} - embed?: Embed.Main = undefined + embed?: GetPostThread.Post['embed'] = undefined parent?: PostThreadViewPostModel replyCount: number = 0 replies?: PostThreadViewPostModel[] diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts index 01e1cacad..90c6ef475 100644 --- a/src/state/models/shell-ui.ts +++ b/src/state/models/shell-ui.ts @@ -58,6 +58,13 @@ export class ProfileImageLightbox { } } +export class ImageLightbox { + name = 'image' + constructor(public uri: string) { + makeAutoObservable(this) + } +} + export interface ComposerOptsPostRef { uri: string cid: string @@ -84,7 +91,7 @@ export class ShellUiModel { | ServerInputModal | undefined isLightboxActive = false - activeLightbox: ProfileImageLightbox | undefined + activeLightbox: ProfileImageLightbox | ImageLightbox | undefined isComposerActive = false composerOpts: ComposerOpts | undefined @@ -116,7 +123,7 @@ export class ShellUiModel { this.activeModal = undefined } - openLightbox(lightbox: ProfileImageLightbox) { + openLightbox(lightbox: ProfileImageLightbox | ImageLightbox) { this.isLightboxActive = true this.activeLightbox = lightbox } |