1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-07 22:45:22 +02:00

fix: script setup #2 and some fixes (#5845)

This commit is contained in:
Kuchenpirat 2025-07-30 02:05:26 +02:00 committed by GitHub
parent a132b83f1b
commit 620465f14c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 312 additions and 528 deletions

View file

@ -20,45 +20,33 @@
</v-data-table>
</template>
<script lang="ts">
<script setup lang="ts">
import { parseISO, formatDistanceToNow } from "date-fns";
import type { GroupDataExport } from "~/lib/api/types/group";
export default defineNuxtComponent({
props: {
exports: {
type: Array as () => GroupDataExport[],
required: true,
},
},
setup() {
const i18n = useI18n();
defineProps<{
exports: GroupDataExport[];
}>();
const headers = [
{ title: i18n.t("export.export"), value: "name" },
{ title: i18n.t("export.file-name"), value: "filename" },
{ title: i18n.t("export.size"), value: "size" },
{ title: i18n.t("export.link-expires"), value: "expires" },
{ title: "", value: "actions" },
];
const i18n = useI18n();
function getTimeToExpire(timeString: string) {
const expiresAt = parseISO(timeString);
const headers = [
{ title: i18n.t("export.export"), value: "name" },
{ title: i18n.t("export.file-name"), value: "filename" },
{ title: i18n.t("export.size"), value: "size" },
{ title: i18n.t("export.link-expires"), value: "expires" },
{ title: "", value: "actions" },
];
return formatDistanceToNow(expiresAt, {
addSuffix: false,
});
}
function getTimeToExpire(timeString: string) {
const expiresAt = parseISO(timeString);
function downloadData(_: any) {
console.log("Downloading data...");
}
return formatDistanceToNow(expiresAt, {
addSuffix: false,
});
}
return {
downloadData,
headers,
getTimeToExpire,
};
},
});
function downloadData(_: any) {
console.log("Downloading data...");
}
</script>

View file

@ -9,30 +9,10 @@
</div>
</template>
<script lang="ts">
export default defineNuxtComponent({
props: {
modelValue: {
type: Object,
required: true,
},
},
emits: ["update:modelValue"],
setup(props, context) {
const preferences = computed({
get() {
return props.modelValue;
},
set(val) {
context.emit("update:modelValue", val);
},
});
<script setup lang="ts">
import type { ReadGroupPreferences } from "~/lib/api/types/user";
return {
preferences,
};
},
});
const preferences = defineModel<ReadGroupPreferences>({ required: true });
</script>
<style lang="scss" scoped></style>