Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiendil committed Jan 15, 2025
1 parent 1847576 commit 6675905
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
24 changes: 12 additions & 12 deletions site/src/components/EntryForList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@
<div
ref="entryTop"
class="flex text-lg">

<div :class="['flex-shrink-0', 'text-right', {'ml-8': isRead}]">
<input-marker
class="w-7 mr-2"
:marker="e.Marker.Read"
:entry-id="entryId">

<template v-slot:marked>
<span class="text-green-700 no-underline" title="Mark as unread">
<i class="ti ti-chevrons-left"/>
<span
class="text-green-700 no-underline"
title="Mark as unread">
<i class="ti ti-chevrons-left" />
</span>
</template>

<template v-slot:unmarked>
<span class="text-orange-700 no-underline" title="Mark as read">
<i class="ti ti-chevrons-right"/>
<span
class="text-orange-700 no-underline"
title="Mark as read">
<i class="ti ti-chevrons-right" />
</span>
</template>

</input-marker>
</div>

<div class="flex-shrink-0 w-8 text-center pr-1 ">
<div class="flex-shrink-0 w-8 text-center pr-1">
<value-score
:value="entry.score"
:entry-id="entry.id" />
Expand Down Expand Up @@ -187,8 +188,7 @@
}
}
onMounted(() => {
entriesStore.requestFullEntry({entryId: properties.entryId});
});
onMounted(() => {
entriesStore.requestFullEntry({entryId: properties.entryId});
});
</script>
19 changes: 7 additions & 12 deletions site/src/inputs/Marker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
<template v-if="hasMarker">
<a
href="#"
@click.prevent="unmark()"
>
@click.prevent="unmark()">
<slot name="marked" />
</a
>
</a>
</template>

<template v-else>
<a
href="#"
@click.prevent="mark()"
>
@click.prevent="mark()">
<slot name="unmarked" />
</a
>
</a>
</template>
</div>
</template>
Expand All @@ -40,20 +36,19 @@
return entriesStore.entries[properties.entryId].hasMarker(properties.marker);
});
async function mark() {
async function mark() {
await entriesStore.setMarker({
entryId: properties.entryId,
marker: properties.marker
});
}
async function unmark() {
async function unmark() {
await entriesStore.removeMarker({
entryId: properties.entryId,
marker: properties.marker
});
}
</script>

<style scoped>
</style>
<style scoped></style>
4 changes: 1 addition & 3 deletions site/src/stores/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const useEntriesStore = defineStore("entriesStore", () => {
requestedEntriesTimer.start();

async function setMarker({entryId, marker}: {entryId: t.EntryId; marker: e.Marker}) {

if (marker === e.Marker.Read) {
readHistory.value.push(entryId);
}
Expand All @@ -101,11 +100,10 @@ export const useEntriesStore = defineStore("entriesStore", () => {
}

async function removeMarker({entryId, marker}: {entryId: t.EntryId; marker: e.Marker}) {

if (marker === e.Marker.Read) {
_.pull(readHistory.value, entryId);

hideEntry({entryId: entryId});
hideEntry({entryId: entryId});
}

// This code must be before the actual API request, see comment above
Expand Down
1 change: 0 additions & 1 deletion site/src/views/NewsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
@click="entriesStore.undoMarkRead()">
</button>

</template>

<template #side-footer>
Expand Down

0 comments on commit 6675905

Please sign in to comment.