Skip to content

Commit

Permalink
added animation when the order of stream changes in queue due to upvo…
Browse files Browse the repository at this point in the history
…tes and downvotes
  • Loading branch information
thepradipvc committed Sep 15, 2024
1 parent d5c1bb8 commit ee6eb9d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions next-app/components/StreamView/Queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { useAutoAnimate } from "@formkit/auto-animate/react";

type Props = {
queue: Video[];
Expand All @@ -23,6 +24,7 @@ type Props = {
export default function Queue({ queue, isCreator, creatorId, userId }: Props) {
const { sendMessage } = useSocket();
const [isEmptyQueueDialogOpen, setIsEmptyQueueDialogOpen] = useState(false);
const [parent] = useAutoAnimate();

function handleVote(id: string, isUpvote: boolean) {
sendMessage("cast-vote", {
Expand Down Expand Up @@ -116,6 +118,7 @@ export default function Queue({ queue, isCreator, creatorId, userId }: Props) {
</CardContent>
</Card>
)}
<div className="space-y-4" ref={parent}>
{queue.map((video) => (
<Card key={video.id} className="">
<CardContent className="flex items-center space-x-4 p-4">
Expand Down Expand Up @@ -156,6 +159,7 @@ export default function Queue({ queue, isCreator, creatorId, userId }: Props) {
</CardContent>
</Card>
))}
</div>
</div>
</div>
<Dialog
Expand Down
1 change: 1 addition & 0 deletions next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"format:check": "prettier --check \"**/*.{ts,tsx,json}\""
},
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
"@prisma/client": "5.19.0",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
Expand Down
8 changes: 8 additions & 0 deletions next-app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"preinstall": "npx only-allow pnpm",
"dev": "nodemon src/app.ts",
"start": "node dist/app.js",
"build": "prisma generate && npx tsc -b",
"postinstall": "prisma generate"
"build": "prisma generate && npx tsc -b"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit ee6eb9d

Please sign in to comment.