<script setup>
import { inject } from 'vue';

import Admin from '#/components/admin/admin.vue';

const { pageProps } = inject('pageContext');

const { templates } = pageProps;
</script>

<template>
	<Admin class="page">
		<ul
			v-if="templates.length > 0"
			class="menu"
		>
			<li v-for="template in templates" :key="template">
				<a
					:href="`/admin/emails/${template}`"
					class="link"
				>{{ template }}</a>
			</li>
		</ul>

		<p v-else>No e-mail templates found in components/emails.</p>
	</Admin>
</template>

<style scoped>
.menu {
	margin: 0;

	.link {
		display: block;
		padding: .25rem;
	}
}
</style>
