Skip to content

Commit 88f77ba

Browse files
authored
Merge pull request #874 from kanriapp/main
Add last minute tweaks/fixes to v0.8.2
2 parents 69491e7 + 43b2845 commit 88f77ba

File tree

8 files changed

+64
-4
lines changed

8 files changed

+64
-4
lines changed

components/modal/EditCard.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ import { vOnClickOutside } from "@vueuse/components";
501501
import { Container, Draggable } from "vue3-smooth-dnd";
502502
//@ts-expect-error library has no types
503503
import { VueTagsInput } from "@vojtechlanka/vue-tags-input";
504+
import { useSettingsStore } from "@/stores/settings";
504505
505506
const props = defineProps<{
506507
card: Card | null;
@@ -562,6 +563,7 @@ const selectedColor = ref("");
562563
563564
const dueDate: Ref<Date | null> = ref(null);
564565
const isDueDateCounterRelative = ref(false);
566+
const settingsStore = useSettingsStore();
565567
const isDueDateCompleted = ref(false);
566568
567569
const tag = ref("");
@@ -623,7 +625,7 @@ const beforeTagAdd = ({ tag, addTag }: any) => {
623625
);
624626
625627
if (!existingTag) {
626-
if (matches.length === 1) {
628+
if (matches.length === 1 && matches[0]) {
627629
tag.text = matches[0].text;
628630
tag.id = matches[0].id;
629631
tag.color = matches[0].color;
@@ -702,7 +704,9 @@ const updateTask = (index: number) => {
702704
!/\S/.test(currentlyEditingTaskName.value);
703705
if (taskNameEmpty || currentlyEditingTaskIndex.value === -1) return;
704706
705-
tasks.value[index].name = currentlyEditingTaskName.value;
707+
if (tasks.value[index]) {
708+
tasks.value[index].name = currentlyEditingTaskName.value;
709+
}
706710
707711
currentlyEditingTaskIndex.value = -1;
708712
currentlyEditingTaskName.value = "";
@@ -803,7 +807,9 @@ watch(props, (newVal) => {
803807
//@ts-expect-error TODO: improve due date handling/types
804808
dueDate.value = newVal.card.dueDate || null;
805809
isDueDateCounterRelative.value =
806-
newVal.card.isDueDateCounterRelative || false;
810+
newVal.card.isDueDateCounterRelative !== undefined
811+
? newVal.card.isDueDateCounterRelative
812+
: settingsStore.defaultRelativeDueDatesEnabled;
807813
isDueDateCompleted.value = newVal.card.isDueDateCompleted || false;
808814
809815
tags.value = newVal.card.tags || [];

i18n/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
"preferencesAddToTopButtonSubtext": "Displays a button which allows you to add new cards to the top of a column.",
6868
"preferencesDisplayNumberOfCardsHeading": "Display number of cards in column",
6969
"preferencesDisplayNumberOfCardsSubtext": "Shows how many cards are in each column.",
70+
"preferencesDefaultRelativeDueDatesHeading": "Use relative due date countdown by default",
71+
"preferencesDefaultRelativeDueDatesSubtext": "Newly set due dates default to relative countdown mode instead of absolute date.",
7072
"languageSelectorHeading": "Language",
7173
"languageSelectorSubtext": "Change the language of the application.",
7274
"miscellaneousHeading": "Miscellaneous",

layouts/default.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ onMounted(async () => {
7272
globalSettingsStore.animationsEnabled = true;
7373
}
7474
75+
// Load defaultRelativeDueDatesEnabled preference
76+
const relativeDueDatesPref = await store.get("defaultRelativeDueDatesEnabled");
77+
if (relativeDueDatesPref !== null) {
78+
globalSettingsStore.defaultRelativeDueDatesEnabled = relativeDueDatesPref;
79+
} else {
80+
await store.set("defaultRelativeDueDatesEnabled", false);
81+
globalSettingsStore.defaultRelativeDueDatesEnabled = false;
82+
}
83+
7584
savedColors.value = await store.get("colors");
7685
autoThemeEnabled.value = await store.get("activeTheme") === "auto" || false;
7786

pages/import.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ const exportJSON = async () => {
216216
const columnZoomLevel = await store.get("columnZoomLevel");
217217
const lastInstalledVersion = await store.get("lastInstalledVersion");
218218
const animationsEnabled = await store.get("animationsEnabled");
219+
const defaultRelativeDueDatesEnabled = await store.get(
220+
"defaultRelativeDueDatesEnabled"
221+
);
219222
const addToTopOfColumnButtonEnabled = await store.get(
220223
"addToTopOfColumnButtonEnabled"
221224
);
@@ -235,6 +238,7 @@ const exportJSON = async () => {
235238
savedCustomTheme,
236239
reverseSorting,
237240
animationsEnabled,
241+
defaultRelativeDueDatesEnabled,
238242
addToTopOfColumnButtonEnabled,
239243
displayColumnCardCountEnabled,
240244
},
@@ -345,6 +349,12 @@ const importFromKanriFull = async () => {
345349
store.set("savedCustomTheme", zodParsed.savedCustomTheme);
346350
store.set("lastInstalledVersion", zodParsed.lastInstalledVersion);
347351
store.set("animationsEnabled", zodParsed.animationsEnabled);
352+
if (zodParsed.defaultRelativeDueDatesEnabled !== undefined) {
353+
store.set(
354+
"defaultRelativeDueDatesEnabled",
355+
zodParsed.defaultRelativeDueDatesEnabled
356+
);
357+
}
348358
store.set("reverseSorting", zodParsed.reverseSorting);
349359
store.set(
350360
"addToTopOfColumnButtonEnabled",

pages/kanban/[id].vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. -->
237237
drag-handle-selector=".dragging-handle"
238238
group-name="columns"
239239
:get-ghost-parent="getGhostParent"
240+
:get-child-payload="(index: number) => board.columns[index]"
240241
@drop="onDrop"
241242
>
242243
<Draggable

pages/settings.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,26 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. -->
204204
/>
205205
</SwitchRoot>
206206
</div>
207+
208+
<div class="mt-4 flex w-[48rem] flex-row items-start justify-between">
209+
<div>
210+
<h3 class="text-lg">
211+
{{ $t("pages.settings.preferencesDefaultRelativeDueDatesHeading") }}
212+
</h3>
213+
<span class="text-dim-2">
214+
{{ $t("pages.settings.preferencesDefaultRelativeDueDatesSubtext") }}
215+
</span>
216+
</div>
217+
<SwitchRoot
218+
v-model:checked="globalSettingsStore.defaultRelativeDueDatesEnabled"
219+
class="bg-elevation-2 bg-accent-checked relative flex h-[24px] w-[42px] cursor-pointer rounded-full shadow-sm focus-within:outline focus-within:outline-black"
220+
@update:checked="toggleDefaultRelativeDueDates"
221+
>
222+
<SwitchThumb
223+
class="bg-button-text my-auto block size-[18px] translate-x-0.5 rounded-full shadow-sm transition-transform duration-100 will-change-transform data-[state=checked]:translate-x-[19px]"
224+
/>
225+
</SwitchRoot>
226+
</div>
207227
</section>
208228

209229
<section id="miscellaneous-settings">
@@ -425,7 +445,7 @@ const deleteAllData = async () => {
425445
activeTheme.value = "dark";
426446
themeEditorDisplayed.value = false;
427447
428-
globalSettingsStore.animationsEnabled.value = true;
448+
globalSettingsStore.animationsEnabled = true;
429449
store.set("animationsEnabled", true); // Reset animations to true
430450
431451
router.go(0);
@@ -467,6 +487,14 @@ const toggleDisplayCardCount = async (displayCardCountToggled: boolean) => {
467487
}
468488
};
469489
490+
const toggleDefaultRelativeDueDates = async (relativeToggled: boolean) => {
491+
if (relativeToggled) {
492+
await store.set("defaultRelativeDueDatesEnabled", true);
493+
} else {
494+
await store.set("defaultRelativeDueDatesEnabled", false);
495+
}
496+
};
497+
470498
const exportThemeToJson = async () => {
471499
const filePath = await save({
472500
defaultPath: "./kanri_theme_export.json",

stores/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
2222
export const useSettingsStore = defineStore("settings", {
2323
state: () => ({
2424
animationsEnabled: true,
25+
// If true, new due dates default to relative countdown mode
26+
defaultRelativeDueDatesEnabled: false,
2527
}),
2628
});

types/json-schemas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export const kanriJsonSchema = z.object({
103103
reverseSorting: z.boolean().optional().nullable(),
104104
addToTopOfColumnButtonEnabled: z.boolean().optional().nullable(),
105105
displayColumnCardCountEnabled: z.boolean().optional().nullable(),
106+
// If enabled, newly created due dates default to relative countdown mode
107+
defaultRelativeDueDatesEnabled: z.boolean().optional().nullable(),
106108
pins: z
107109
.array(
108110
z.object({

0 commit comments

Comments
 (0)