I firmly believe in free software. The application I'm making here have capabilities that I've not seen in any system. It presents itself as an opportunity to collaborate on a tool that serves the people rather than corporations. Whose incentives are to help people rather, not make the most money. And whose terms ensure that these freedoms and incentives cannot be taken back or subverted. I license this software under the AGPL.
40 lines
885 B
Vue
40 lines
885 B
Vue
<!--
|
|
SPDX-FileCopyrightText: © 2025 Hornwitser <code@hornwitser.no>
|
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
-->
|
|
<template>
|
|
<DiffEntry
|
|
:title
|
|
:entries
|
|
/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
const props = defineProps<{
|
|
title: string,
|
|
before: string,
|
|
after: string,
|
|
state: "deleted" | "created" | "modified",
|
|
}>();
|
|
const entries = computed((): ["added" | "removed", string][] => {
|
|
if (props.state === "created") {
|
|
return props.after ? [["added", props.after]] : [];
|
|
}
|
|
if (props.state === "deleted") {
|
|
return props.before ? [["removed", props.before]] : [];
|
|
}
|
|
if (props.state === "modified") {
|
|
if (props.after === props.before)
|
|
return [];
|
|
if (!props.after)
|
|
return [["removed", props.before]];
|
|
if (!props.before)
|
|
return [["added", props.after]];
|
|
return [
|
|
["removed", props.before],
|
|
["added", props.after],
|
|
];
|
|
}
|
|
return [];
|
|
});
|
|
</script>
|