diff --git a/front/src/components/playlists/Editor.vue b/front/src/components/playlists/Editor.vue index c137e8a34..43b149c12 100644 --- a/front/src/components/playlists/Editor.vue +++ b/front/src/components/playlists/Editor.vue @@ -1,9 +1,159 @@ + + @@ -43,14 +193,14 @@ class="ui warning message" > Some tracks in your queue are already in this playlist: @@ -74,7 +224,7 @@ @@ -100,9 +250,9 @@ Do you want to clear the playlist "%{ playlist }"? @@ -123,7 +273,7 @@ - + Drag and drop rows to reorder tracks in the playlist @@ -132,7 +282,7 @@ - - diff --git a/front/src/components/playlists/Form.vue b/front/src/components/playlists/Form.vue index 0bf17160d..edd0f6bf8 100644 --- a/front/src/components/playlists/Form.vue +++ b/front/src/components/playlists/Form.vue @@ -1,3 +1,101 @@ + + - - diff --git a/front/src/components/playlists/PlaylistModal.vue b/front/src/components/playlists/PlaylistModal.vue index 65b2e433a..76f7813e1 100644 --- a/front/src/components/playlists/PlaylistModal.vue +++ b/front/src/components/playlists/PlaylistModal.vue @@ -52,7 +52,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => { lastSelectedPlaylist.value = playlistId try { - await axios.post(`playlists/${playlistId}/add`, { + await axios.post(`playlists/${playlistId}/add/`, { tracks: [track.value?.id].filter(i => i), allow_duplicates: allowDuplicates }) @@ -106,7 +106,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => { - + , - profile: null | Profile + profile: null | User oauth: OAuthTokens scopedTokens: ScopedTokens } -interface Profile { - id: string - avatar?: string - username: string - full_username: string - instance_support_message_display_date: string - funkwhale_support_message_display_date: string - is_superuser: boolean -} - interface ScopedTokens { listen: null | string } @@ -136,13 +127,13 @@ const store: Module = { permission: (state, { key, status }: { key: Permission, status: boolean }) => { state.availablePermissions[key] = status }, - profilePartialUpdate: (state, payload: Profile) => { + profilePartialUpdate: (state, payload: User) => { if (!state.profile) { - state.profile = {} as Profile + state.profile = {} as User } for (const [key, value] of Object.entries(payload)) { - state.profile[key as keyof Profile] = value as never + state.profile[key as keyof User] = value as never } }, oauthApp: (state, payload) => { @@ -160,7 +151,7 @@ const store: Module = { const form = useFormData(credentials) return axios.post('users/login', form).then(() => { logger.info('Successfully logged in as', credentials.username) - dispatch('fetchProfile').then(() => { + dispatch('fetchUser').then(() => { // Redirect to a specified route import('~/router').then((router) => { return router.default.push(next) @@ -190,11 +181,11 @@ const store: Module = { }) logger.info('Log out, goodbye!') }, - fetchProfile ({ dispatch }) { + fetchUser ({ dispatch }) { return new Promise((resolve, reject) => { axios.get('users/me/').then((response) => { logger.info('Successfully fetched user profile') - dispatch('updateProfile', response.data) + dispatch('updateUser', response.data) dispatch('ui/fetchUnreadNotifications', null, { root: true }) if (response.data.permissions.library) { dispatch('ui/fetchPendingReviewEdits', null, { root: true }) @@ -215,7 +206,7 @@ const store: Module = { }) }) }, - updateProfile ({ commit }, data) { + updateUser ({ commit }, data) { commit('authenticated', true) commit('profile', data) commit('username', data.username) @@ -253,7 +244,7 @@ const store: Module = { { headers: { 'Content-Type': 'multipart/form-data' } } ) commit('oauthToken', response.data) - await dispatch('fetchProfile') + await dispatch('fetchUser') }, async refreshOauthToken ({ state, commit }) { const payload = { diff --git a/front/src/types.ts b/front/src/types.ts index e0132e5b0..98bcf7afd 100644 --- a/front/src/types.ts +++ b/front/src/types.ts @@ -159,7 +159,24 @@ export interface License { export interface Playlist { id: string name: string - modification_date: Date // TODO (wvffle): Find correct type + modification_date: string + user: User + privacy_level: PrivacyLevel + tracks_count: number + duration: number + + is_playable: boolean +} + +export interface PlaylistTrack { + track: Track + position?: number +} + +export interface Radio { + id: string + name: string + user: User } // API stuff @@ -253,6 +270,7 @@ export interface FSLogs { // Profile stuff export interface Actor { + id: string fid?: string name?: string icon?: Cover @@ -263,6 +281,17 @@ export interface Actor { domain: string } +export interface User { + id: string + avatar?: string + username: string + full_username: string + instance_support_message_display_date: string + funkwhale_support_message_display_date: string + is_superuser: boolean + privacy_level: PrivacyLevel +} + // Settings stuff export type SettingsId = 'instance' export interface SettingsGroup { diff --git a/front/src/views/playlists/Detail.vue b/front/src/views/playlists/Detail.vue index 5fc264e76..ecd8f1edc 100644 --- a/front/src/views/playlists/Detail.vue +++ b/front/src/views/playlists/Detail.vue @@ -1,3 +1,74 @@ + + @@ -137,10 +208,8 @@ @@ -177,81 +246,3 @@ - diff --git a/front/src/views/radios/Detail.vue b/front/src/views/radios/Detail.vue index aa979228c..97bb16e90 100644 --- a/front/src/views/radios/Detail.vue +++ b/front/src/views/radios/Detail.vue @@ -1,3 +1,63 @@ + + @@ -101,9 +160,9 @@ Edit… @@ -111,76 +170,3 @@ - -
Some tracks in your queue are already in this playlist:
Do you want to clear the playlist "%{ playlist }"?
Drag and drop rows to reorder tracks in the playlist @@ -132,7 +282,7 @@ - - diff --git a/front/src/components/playlists/Form.vue b/front/src/components/playlists/Form.vue index 0bf17160d..edd0f6bf8 100644 --- a/front/src/components/playlists/Form.vue +++ b/front/src/components/playlists/Form.vue @@ -1,3 +1,101 @@ + + - - diff --git a/front/src/components/playlists/PlaylistModal.vue b/front/src/components/playlists/PlaylistModal.vue index 65b2e433a..76f7813e1 100644 --- a/front/src/components/playlists/PlaylistModal.vue +++ b/front/src/components/playlists/PlaylistModal.vue @@ -52,7 +52,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => { lastSelectedPlaylist.value = playlistId try { - await axios.post(`playlists/${playlistId}/add`, { + await axios.post(`playlists/${playlistId}/add/`, { tracks: [track.value?.id].filter(i => i), allow_duplicates: allowDuplicates }) @@ -106,7 +106,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => { - + , - profile: null | Profile + profile: null | User oauth: OAuthTokens scopedTokens: ScopedTokens } -interface Profile { - id: string - avatar?: string - username: string - full_username: string - instance_support_message_display_date: string - funkwhale_support_message_display_date: string - is_superuser: boolean -} - interface ScopedTokens { listen: null | string } @@ -136,13 +127,13 @@ const store: Module = { permission: (state, { key, status }: { key: Permission, status: boolean }) => { state.availablePermissions[key] = status }, - profilePartialUpdate: (state, payload: Profile) => { + profilePartialUpdate: (state, payload: User) => { if (!state.profile) { - state.profile = {} as Profile + state.profile = {} as User } for (const [key, value] of Object.entries(payload)) { - state.profile[key as keyof Profile] = value as never + state.profile[key as keyof User] = value as never } }, oauthApp: (state, payload) => { @@ -160,7 +151,7 @@ const store: Module = { const form = useFormData(credentials) return axios.post('users/login', form).then(() => { logger.info('Successfully logged in as', credentials.username) - dispatch('fetchProfile').then(() => { + dispatch('fetchUser').then(() => { // Redirect to a specified route import('~/router').then((router) => { return router.default.push(next) @@ -190,11 +181,11 @@ const store: Module = { }) logger.info('Log out, goodbye!') }, - fetchProfile ({ dispatch }) { + fetchUser ({ dispatch }) { return new Promise((resolve, reject) => { axios.get('users/me/').then((response) => { logger.info('Successfully fetched user profile') - dispatch('updateProfile', response.data) + dispatch('updateUser', response.data) dispatch('ui/fetchUnreadNotifications', null, { root: true }) if (response.data.permissions.library) { dispatch('ui/fetchPendingReviewEdits', null, { root: true }) @@ -215,7 +206,7 @@ const store: Module = { }) }) }, - updateProfile ({ commit }, data) { + updateUser ({ commit }, data) { commit('authenticated', true) commit('profile', data) commit('username', data.username) @@ -253,7 +244,7 @@ const store: Module = { { headers: { 'Content-Type': 'multipart/form-data' } } ) commit('oauthToken', response.data) - await dispatch('fetchProfile') + await dispatch('fetchUser') }, async refreshOauthToken ({ state, commit }) { const payload = { diff --git a/front/src/types.ts b/front/src/types.ts index e0132e5b0..98bcf7afd 100644 --- a/front/src/types.ts +++ b/front/src/types.ts @@ -159,7 +159,24 @@ export interface License { export interface Playlist { id: string name: string - modification_date: Date // TODO (wvffle): Find correct type + modification_date: string + user: User + privacy_level: PrivacyLevel + tracks_count: number + duration: number + + is_playable: boolean +} + +export interface PlaylistTrack { + track: Track + position?: number +} + +export interface Radio { + id: string + name: string + user: User } // API stuff @@ -253,6 +270,7 @@ export interface FSLogs { // Profile stuff export interface Actor { + id: string fid?: string name?: string icon?: Cover @@ -263,6 +281,17 @@ export interface Actor { domain: string } +export interface User { + id: string + avatar?: string + username: string + full_username: string + instance_support_message_display_date: string + funkwhale_support_message_display_date: string + is_superuser: boolean + privacy_level: PrivacyLevel +} + // Settings stuff export type SettingsId = 'instance' export interface SettingsGroup { diff --git a/front/src/views/playlists/Detail.vue b/front/src/views/playlists/Detail.vue index 5fc264e76..ecd8f1edc 100644 --- a/front/src/views/playlists/Detail.vue +++ b/front/src/views/playlists/Detail.vue @@ -1,3 +1,74 @@ + + @@ -137,10 +208,8 @@ @@ -177,81 +246,3 @@ - diff --git a/front/src/views/radios/Detail.vue b/front/src/views/radios/Detail.vue index aa979228c..97bb16e90 100644 --- a/front/src/views/radios/Detail.vue +++ b/front/src/views/radios/Detail.vue @@ -1,3 +1,63 @@ + + @@ -101,9 +160,9 @@ Edit… @@ -111,76 +170,3 @@ - -