Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#35): add attachments to video form #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jlabatut
Copy link
Member

@jlabatut jlabatut commented Dec 6, 2022

closes #35

How to test :

  • Create several attachments from profile page (http://localhost:3000/users/profile/attachments)
  • Create a video and add attachments (check if modal checkboxes and attachments items on the main page are synced)
  • Check if the attachments appear on the video player page (switch to "Attachments" tab)
  • Update the video, check if the previously added attachments are still in the video, change the linked attachments, then re-check on the video player if update is effective.

@sylvain-reynaud
Copy link
Member

What is the status of this PR ?

@LeoFVO
Copy link
Member

LeoFVO commented Dec 17, 2022

@jlabatut Hey, i was reviewing you're PR, and it doesn't work in mocked environment, any reasons ?

<CopyToClipboard
onCopy={() => {
snackbarService.createSnackbar(
tUsers('profile.tabs.attachments.content.list.clipboard'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tUsers('profile.tabs.attachments.content.list.clipboard'),
t('profile.tabs.attachments.content.list.clipboard', { ns: 'user' }),

Comment on lines +16 to +17
const { t: tUsers } = useTranslation('users')
const { t: tAttachments } = useTranslation('attachments')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use only one useTranslation('user') or useTranslation('attachements') then if you want to change use namespace

t('profile.tabs.attachments.content.list.clipboard', { ns: 'user' })

}}
text={url}
>
<Tooltip title={tAttachments<string>('actions.copyToClipboard')}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Tooltip title={tAttachments<string>('actions.copyToClipboard')}>
<Tooltip title={t<string>('actions.copyToClipboard')}>

useEffect(() => {
/* Since the attachments are not invalidated after a video update, we need to refetch them here */
if (data) refetch()
}, [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, [])
}, [data])

}
}
}
}, [videoId, data])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

Suggested change
}, [videoId, data])
}, [videoId, data, fields])

}
disablePadding
>
<ListItemButton onClick={handleToggle(item)}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, but i'm not sure

Comment on lines +178 to +181
{!isLoading &&
(data &&
data.items.length > 0 &&
data.items.length < data.totalCount ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can group everything into one function for clarity

/>
</Box>
) : (
!data ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can group everything into one function for clarity

@@ -40,7 +40,7 @@ export const attachmentsApi = createApi({
}),
getVideoAttachments: builder.query<PaginatedAttachments, string>({
query: (videoId: string) => {
return `${Endpoint.Attachments}/video/${videoId}`
return `${Endpoint.Attachments}/video/${videoId}?pageSize=50&page=1` // TODO : remove pagination from attachment service (only for /video/id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo ?

useEffect(() => {
/* Since the attachments are not invalidated after a video update, we need to refetch them here */
if (attachments) refetch()
}, [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, [])
}, [attachments])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: Allow contributors to add attachments during video creation/edition
4 participants