Skip to content

Commit

Permalink
chore: cleaning and beautify code
Browse files Browse the repository at this point in the history
  • Loading branch information
burhanyilmaz committed May 6, 2024
1 parent 5fae064 commit ca3ca9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/screens/Blog/PostDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const PostDetailScreen = () => {
});

const onPressSave = () => post && savedStore.addPost(post);

const onPressShare = async () => {
post &&
Share.share({
Expand Down
12 changes: 0 additions & 12 deletions src/screens/Test/index.tsx

This file was deleted.

10 changes: 8 additions & 2 deletions src/store/PostStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export const Post = t
}

const media = yield api.getMediaByUrl(self.mediaUrl);
const mediaSizes = media?.media_details;
const renderedMedia = media?.guid?.rendered;

self.image = media?.media_details?.sizes?.medium?.source_url || media?.guid?.rendered;
self.headerImage = media?.media_details?.sizes?.large?.source_url || media?.guid?.rendered;
self.image = mediaSizes?.medium?.source_url || renderedMedia;
self.headerImage = mediaSizes?.large?.source_url || renderedMedia;
self.imageLoaded = true;
}),

Expand Down Expand Up @@ -56,9 +58,11 @@ const PostStore = t
get listingPosts() {
return Array.from(self.posts.values()).slice(4, self.posts.size);
},

getSelectedPost(id: string) {
return self.posts.get(id);
},

get sliderPosts() {
return Array.from(self.posts.values()).slice(0, 4);
},
Expand Down Expand Up @@ -94,7 +98,9 @@ const PostStore = t
if (!self.url) {
return;
}

this.setLoading(true);

try {
const posts = await api.getPost(self.page);

Expand Down

0 comments on commit ca3ca9d

Please sign in to comment.