mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-17 06:00:20 +02:00
Adjust play status
This commit is contained in:
@@ -15,7 +15,6 @@ import { useAuthStore, usePlayerStore } from '@/renderer/store';
|
|||||||
import { PlayerStatus } from '@/renderer/types';
|
import { PlayerStatus } from '@/renderer/types';
|
||||||
|
|
||||||
const UserActivityContainer = styled(motion.div)`
|
const UserActivityContainer = styled(motion.div)`
|
||||||
min-height: 10rem;
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@ type UserConnectionEvent = {
|
|||||||
|
|
||||||
type SongChangeEvent = {
|
type SongChangeEvent = {
|
||||||
song: Activity['song'];
|
song: Activity['song'];
|
||||||
|
status: Activity['status'];
|
||||||
user: UserConnectionEvent;
|
user: UserConnectionEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ export const UserActivity = () => {
|
|||||||
...user.activity,
|
...user.activity,
|
||||||
socketId: data.user.socketId,
|
socketId: data.user.socketId,
|
||||||
song: data.song,
|
song: data.song,
|
||||||
status: shouldUpdateStatus ? 'playing' : user?.activity?.status,
|
status: shouldUpdateStatus ? data.status : user?.activity?.status,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
@@ -163,13 +163,10 @@ export const UserActivity = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleUserStatusChange = useCallback((data: PlayStatusChangeEvent) => {
|
const handleUserStatusChange = useCallback((data: PlayStatusChangeEvent) => {
|
||||||
console.log('data', data);
|
|
||||||
setActivityList((prev) => {
|
setActivityList((prev) => {
|
||||||
const user = prev.find((user) => user.id === data.user.userId);
|
const user = prev.find((user) => user.id === data.user.userId);
|
||||||
if (!user) return prev;
|
if (!user) return prev;
|
||||||
|
|
||||||
console.log('data.status', data.status);
|
|
||||||
|
|
||||||
return sortByName([
|
return sortByName([
|
||||||
...prev.filter((user) => user.id !== data.user.userId),
|
...prev.filter((user) => user.id !== data.user.userId),
|
||||||
{
|
{
|
||||||
@@ -200,6 +197,7 @@ export const UserActivity = () => {
|
|||||||
|
|
||||||
socket.emit('user:send:change_song', {
|
socket.emit('user:send:change_song', {
|
||||||
song: currentSongDetails,
|
song: currentSongDetails,
|
||||||
|
status: playStatus,
|
||||||
user: userDetails,
|
user: userDetails,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user