Browse Source

fix: pr review changes

pull/9323/head
DarkPhoenix2704 2 months ago
parent
commit
e312b486de
  1. 14
      packages/nc-gui/components/dashboard/Sidebar/Feed.vue
  2. 4
      packages/nc-gui/components/feed/Changelog/index.vue
  3. 12
      packages/nc-gui/components/feed/Recents/index.vue
  4. 3
      packages/nc-gui/components/feed/Youtube/index.vue
  5. 12
      packages/nc-gui/composables/useProductFeed.ts
  6. 2
      packages/nc-gui/lib/types.ts
  7. 15
      packages/nocodb/src/services/utils.service.ts

14
packages/nc-gui/components/dashboard/Sidebar/Feed.vue

@ -2,15 +2,19 @@
import dayjs from 'dayjs'
const { navigateToFeed } = useWorkspace()
const { loadFeed } = useProductFeed()
const productFeed = useProductFeed()
const isNewFeedAvailable = ref(true)
const { loadFeed } = productFeed
const { socialFeed } = toRefs(productFeed)
const isNewFeedAvailable = ref(false)
const checkNewFeed = async () => {
const feed = await loadFeed({ type: 'all', loadMore: false })
if (!feed.length) return
await loadFeed({ type: 'all', loadMore: false })
if (!socialFeed.value.length) return
const [latestFeed] = feed
const [latestFeed] = socialFeed.value
const lastFeedTime = localStorage.getItem('lastFeedPublishedTime')
const lastFeed = dayjs(lastFeedTime)

4
packages/nc-gui/components/feed/Changelog/index.vue

@ -7,12 +7,10 @@ const { isLoading } = useInfiniteScroll(
scrollContainer,
async () => {
if (isLoading.value) return
const data = await loadFeed({
await loadFeed({
type: 'github',
loadMore: true,
})
githubFeed.value = [...githubFeed.value, ...data]
},
{ distance: 1, interval: 2000 },
)

12
packages/nc-gui/components/feed/Recents/index.vue

@ -7,14 +7,10 @@ const { isLoading } = useInfiniteScroll(
scrollContainer,
async () => {
if (isLoading.value) return
const data = (
await loadFeed({
type: 'all',
loadMore: true,
})
).filter((item) => item['Feed Source'] !== 'Twitter')
socialFeed.value = [...socialFeed.value, ...data]
await loadFeed({
type: 'all',
loadMore: true,
})
},
{ distance: 1, interval: 2000 },
)

3
packages/nc-gui/components/feed/Youtube/index.vue

@ -7,11 +7,10 @@ const { isLoading } = useInfiniteScroll(
scrollContainer,
async () => {
if (isLoading.value) return
const data = await loadFeed({
await loadFeed({
type: 'youtube',
loadMore: true,
})
youtubeFeed.value = [...youtubeFeed.value, ...data]
},
{ distance: 1, interval: 2000 },
)

12
packages/nc-gui/composables/useProductFeed.ts

@ -45,7 +45,17 @@ export const useProductFeed = createSharedComposable(() => {
localStorage.setItem('last_published_at', response[0]['Published Time'] as string)
}
return response
switch (type) {
case 'youtube':
youtubeFeed.value = [...youtubeFeed.value, ...response] as ProductFeedItem[]
break
case 'github':
githubFeed.value = [...githubFeed.value, ...response] as ProductFeedItem[]
break
case 'all':
socialFeed.value = [...socialFeed.value, ...response] as ProductFeedItem[]
break
}
} catch (error) {
switch (type) {
case 'youtube':

2
packages/nc-gui/lib/types.ts

@ -281,7 +281,7 @@ interface ProductFeedItem {
Id: string
Title: string
Description: string
['Feed Source']: 'Youtube' | 'Github' | 'Twitter'
['Feed Source']: 'Youtube' | 'Github' | 'All'
Url: string
Tags?: string
['Published Time']: string

15
packages/nocodb/src/services/utils.service.ts

@ -509,13 +509,16 @@ export class UtilsService {
let response;
try {
response = await axios.get('https://nocodb.com/api/v1/social/feed', {
params: {
per_page,
page,
type,
response = await axios.get(
'http://product-feed.nocodb.com/v1/social/feed',
{
params: {
per_page,
page,
type,
},
},
});
);
} catch (e) {
console.log(e);
return [];

Loading…
Cancel
Save