[ui] also mark NUM_VISITED (preparation for frecency)
parent
9893292ac8
commit
4dcaeda3e9
|
@ -1,6 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { putEntityAttribute } from "../lib/api";
|
||||
import { normUrl } from "../util/history";
|
||||
|
||||
import Inspect from "./Inspect.svelte";
|
||||
|
@ -19,11 +18,6 @@
|
|||
function visit() {
|
||||
window.open(normUrl(`/browse/${address}`), "_blank");
|
||||
}
|
||||
|
||||
$: putEntityAttribute(address, "LAST_VISITED", {
|
||||
t: "Number",
|
||||
c: new Date().getTime() / 1000,
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="view" class:editable class:detail>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<script lang="ts">
|
||||
import AttributeView from "./AttributeView.svelte";
|
||||
import { query, useEntity } from "../lib/entity";
|
||||
import UpObject from "./display/UpObject.svelte";
|
||||
import UpObjectDisplay from "./display/UpObject.svelte";
|
||||
import { UpType } from "../lib/types";
|
||||
import BlobPreview from "./display/BlobPreview.svelte";
|
||||
import { createEventDispatcher, setContext } from "svelte";
|
||||
import { writable } from "svelte/store";
|
||||
import type { UpEntry } from "upend";
|
||||
import type { UpEntry, UpObject } from "upend";
|
||||
import Spinner from "./utils/Spinner.svelte";
|
||||
import NotesEditor from "./utils/NotesEditor.svelte";
|
||||
import type { AttributeChange } from "../types/base";
|
||||
|
@ -100,7 +99,10 @@
|
|||
}
|
||||
|
||||
$: filteredUntypedAttributes = untypedAttributes.filter(
|
||||
(entry) => !["IS", "LBL", "NOTE", "LAST_VISITED"].includes(entry.attribute)
|
||||
(entry) =>
|
||||
!["IS", "LBL", "NOTE", "LAST_VISITED", "NUM_VISITED"].includes(
|
||||
entry.attribute
|
||||
)
|
||||
);
|
||||
|
||||
$: currentUntypedAttributes = editable
|
||||
|
@ -186,13 +188,27 @@
|
|||
dispatch("close");
|
||||
}
|
||||
}
|
||||
|
||||
$: entity.subscribe(async (object) => {
|
||||
if (object) {
|
||||
await putEntityAttribute(object.address, "LAST_VISITED", {
|
||||
t: "Number",
|
||||
c: new Date().getTime() / 1000,
|
||||
});
|
||||
|
||||
await putEntityAttribute(object.address, "NUM_VISITED", {
|
||||
t: "Number",
|
||||
c: (parseInt(String(object.get("NUM_VISITED"))) || 0) + 1,
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="inspect">
|
||||
<header>
|
||||
<h2>
|
||||
{#if $entity}
|
||||
<UpObject banner {address} on:resolved={onResolved} />
|
||||
<UpObjectDisplay banner {address} on:resolved={onResolved} />
|
||||
{:else}
|
||||
<Spinner centered />
|
||||
{/if}
|
||||
|
@ -205,7 +221,7 @@
|
|||
<div class="content">
|
||||
{#each groups as [entryAddress, address]}
|
||||
<div class="group">
|
||||
<UpObject {address} link />
|
||||
<UpObjectDisplay {address} link />
|
||||
{#if editable}
|
||||
<IconButton
|
||||
name="x-circle"
|
||||
|
|
|
@ -7,6 +7,7 @@ const DEFAULT_ATTRIBUTE_LABELS = {
|
|||
FILE_SIZE: "File size",
|
||||
ADDED: "Added at",
|
||||
LAST_VISITED: "Last visited at",
|
||||
NUM_VISITED: "Times visited",
|
||||
LBL: "Label",
|
||||
IS: "Type",
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue