movie-night-web/app/pages/lists/index.vue

82 lines
1.7 KiB
Vue
Raw Normal View History

2026-02-16 19:12:00 -06:00
<script lang="ts" setup>
import PageTitle from "~/components/common/page-title.vue";
import CreateListForm from "~/components/forms/create-list-form.vue";
import type {MovieList} from "~/types/movie-list";
2026-02-24 00:30:07 -06:00
const {data: lists, refresh, error} = await useApiData<MovieList[]>("/api/movielists")
if (error.value) {
alert(error.value)
}
2026-02-24 00:30:07 -06:00
const refreshLists = () => {
refresh()
}
2026-02-16 19:12:00 -06:00
</script>
<template>
<PageTitle title="Lists"/>
<div class="content">
2026-02-24 00:30:07 -06:00
<CreateListForm @refreshLists="refreshLists"/>
2026-02-16 19:12:00 -06:00
<div class="w-full flex flex-col gap-5">
<h2 class="text-2xl font-bold">Your Lists</h2>
<ul class="movie-list">
2026-02-24 00:30:07 -06:00
<li v-for="list in lists"
:key="list.id"
>
<NuxtLink :to="`/lists/${list.id}`" class="movielist-details">
<span>{{ list.name }}</span>
<span>{{ list.is_public ? 'Public' : 'Private' }}</span>
</NuxtLink>
2026-02-16 19:12:00 -06:00
</li>
</ul>
</div>
2026-02-24 00:30:26 -06:00
<!-- <div class="w-full flex flex-col gap-5">
2026-02-16 19:12:00 -06:00
<h2 class="text-2xl font-bold">Shared With You</h2>
<ul class="w-full flex flex-col gap-3">
2026-02-24 00:31:42 -06:00
<li class="flex justify-between items-center p-4 bg-gray-700/50 rounded-lg hover:bg-gray-600/50 transition-colors">
<NuxtLink to="lists/2">Bob's MovieList</NuxtLink>
2026-02-16 19:12:00 -06:00
</li>
</ul>
</div>
2026-02-24 00:30:26 -06:00
-->
2026-02-16 19:12:00 -06:00
</div>
</template>
<style scoped>
.content {
display: flex;
flex-direction: column;
gap: 2rem;
}
.movie-list {
display: grid;
gap: 1rem;
}
.movie-list li {
display: flex;
justify-content: space-between;
padding: 1rem 0;
}
.movielist-details {
display: flex;
gap: 1rem;
justify-content: space-between;
width: 100%;
}
.movie-list li:hover {
background-color: #eee;
padding: 1rem 0;
border-radius: 0.5rem;
}
2026-02-16 19:12:00 -06:00
</style>