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: 👔 add testimonials using key-value storage #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions app/components/Admin/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
class="max-lg:hidden"
:ui="{ base: 'py-5', active: 'after:bg-black dark:after:bg-white' }"
/>
<div aria-hidden="true" class="-ml-4 flex-1" />
<div
aria-hidden="true"
class="-ml-4 flex-1"
/>
<div class="flex items-center gap-2">
<UButton
icon="i-ph-sign-out-duotone"
Expand All @@ -48,11 +51,11 @@
</template>

<script setup>
const mobileMenu = ref(false);
const mobileMenu = ref(false)
const toggleMobileMenu = () => {
document.body.style.overflow = mobileMenu.value ? "auto" : "hidden";
mobileMenu.value = !mobileMenu.value;
};
document.body.style.overflow = mobileMenu.value ? "auto" : "hidden"
mobileMenu.value = !mobileMenu.value
}

defineProps({
storeAvatarUrl: {
Expand All @@ -63,7 +66,7 @@ defineProps({
type: String,
required: true,
},
});
})
const menuItems = [
{
label: "Orders",
Expand All @@ -77,19 +80,25 @@ const menuItems = [
exact: true,
exactHash: true,
},
{
label: "Testimonials",
to: "/admin/testimonials",
exact: true,
exactHash: true,
},
{
label: "Settings",
to: "/admin/settings",
exact: true,
exactHash: true,
},
];
]

const { clear, fetch: refreshSession } = useUserSession();
const { clear, fetch: refreshSession } = useUserSession()

const logout = async () => {
await clear();
await refreshSession();
return navigateTo("/");
};
await clear()
await refreshSession()
return navigateTo("/")
}
</script>
83 changes: 83 additions & 0 deletions app/components/Admin/TestimonialsTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<template>
<div class="mt-8">
<UTable
:rows="testimonials"
:columns="columns"
:loading="loading"
>
<template #loading-state>
<div class="flex items-center justify-center h-32">
<Icon
name="i-ph-spinner"
class="w-6 h-6 animate-spin"
/>
</div>
</template>
<template #empty-state>
<div class="flex flex-col items-center justify-center py-6 gap-3">
<div class="text-sm text-gray-500 dark:text-gray-400">
{{ loading ? "Loading testimonials..." : "No testimonials found" }}
</div>
</div>
</template>
<template #author.avatar-data="{ row }">
<div class="flex flex-col gap-2">
<UAvatar
:src="row.author.src"
alt="Author avatar"
/>
</div>
</template>
<template #author.name-data="{ row }">
<p>
{{ row.author.name }}
</p>
</template>
<template #author.description-data="{ row }">
<p>
{{ row.author.description }}
</p>
</template>
<template #title-data="{ row }">
<p>
{{ row.title }}
</p>
</template>
<template #quote-data="{ row }">
<p>
{{ row.quote }}
</p>
</template>
<template #actions-data="{ row }">
<UButton
color="red"
variant="ghost"
label="delete"
@click="emit('onDelete', row)"
/>
</template>
</UTable>
</div>
</template>

<script lang="ts" setup>
defineProps<{
testimonials: Testimonial[]
loading: boolean
}>()

const columns = [
{ key: "author.avatar", label: "Author Avatar" },
{ key: "author.name", label: "Author Name" },
{ key: "author.description", label: "Author Description" },
{ key: "title", label: "Title" },
{ key: "quote", label: "Quote" },
{
key: "actions",
},
]

const emit = defineEmits<{
(e: "onDelete", value: Testimonial): void
}>()
</script>
105 changes: 1 addition & 104 deletions app/components/Home/Testimonials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,110 +54,7 @@
</template>

<script setup>
const testimonials = [
{
title: "Super Powerful",
quote:
"The stack that Supersaas is built upon is super powerful and easy to work with, especially when used with NuxtHub / Cloudflare. Fayaz has been super helpful in making it work and adopting feedback.",
author: {
name: "Tim Pulver",
description: "Freelancer/Software Engineer",
avatar: {
src: "https://pbs.twimg.com/profile_images/985092522329468928/qcfeEMbF_400x400.jpg",
loading: "lazy",
},
},
},
{
title: "Features i would buy it for",
quote:
"This is really well made! especially with features like passkey and hooks for everything. These are the features i would buy it for",
author: {
name: "Rishi Mohan",
description: "Founder, Pika.Style",
avatar: {
src: "https://pbs.twimg.com/profile_images/1792311421994147840/ZO_-Kmol_400x400.jpg",
loading: "lazy",
},
},
},
{
title: "Fantastic",
quote: "👆🏻 As a customer I can confirm, it's fantastic 🔥",
author: {
name: "Thomas Sanlis",
description: "Founder, Unned.best",
avatar: {
src: "https://essentials.supersaas.dev/thomas.jpg",
loading: "lazy",
},
},
},
{
title: "Absolute time saver",
quote:
"It's an absolute time saver! If you are a freelancer or keep building things, get this! ✨",
author: {
name: "Mushtaq Ahmed",
description: "Senior Product Engineer, Locale.ai",
avatar: {
src: "https://pbs.twimg.com/profile_images/1823266963553964032/CTnrLhkL_400x400.jpg",
loading: "lazy",
},
},
},
{
title: "Satisfaction 100%",
quote: "I’m very satisfied of your boilerplate. Thanks!",
author: {
name: "Lilian",
description: "SoftwareEngineer",
avatar: {
src: "",
loading: "lazy",
},
},
},
{
title: "Simple yet awesome",
quote:
"I was struggling with implementing payment and auth in my side projects when I found http://supersaas.dev . Its super simple, with all the necessary things bundled together with proper documentation and abstractions. I got to launch my project in a days work and didnt have to think about the logistics of wiring everything up and was just able to concentrate on my core product. If that aint super i dont know what is.. the founder support is again amazing. He got on a call to ensure everything was implemented correctl",
author: {
name: "Sooraj",
description: "Backend Engineer",
avatar: {
src: "https://pbs.twimg.com/profile_images/1823407485002113024/6pxHkYUj_400x400.jpg",
loading: "lazy",
},
},
},
{
title: "Love it!",
quote:
"Really well made. Great news! Im playing with Supersaas template and its been amazing! Learned a lot. Thinking about starting to build something with it. Love it!",
author: {
name: "Alexandr Os",
description: "Engineer and Foudnder",
avatar: {
src: "https://pbs.twimg.com/profile_images/1811928265621229568/ejtIodY5_400x400.jpg",
loading: "lazy",
},
},
},
{
title: "Saving me a shit ton of time",
quote:
"Using these for my side project. This is saving me a shit ton of time and effort. Really happy I purchased this.",
author: {
name: "Attaullah F",
description: "Senior Engineer, Congnizant",
avatar: {
src: "https://essentials.supersaas.dev/62116.jpg",
loading: "lazy",
},
},
},
];
const { data: testimonials } = useFetch("/api/testimonials")
</script>

<style></style>
Loading