crazy stuff
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<script>
|
||||
import { getContext, onMount } from "svelte";
|
||||
import RecordRow from "./RecordRow.svelte";
|
||||
import ChannelLayout from "../../layouts/ChannelLayout.svelte";
|
||||
import { get } from "../../modules/remote";
|
||||
let { channel, user } = $props();
|
||||
let records = $state([]);
|
||||
let graph = $state(null);
|
||||
let users = $state([]);
|
||||
onMount(() => {
|
||||
get(channel.lucentUrl + "/home/records", {}, (data) => {
|
||||
records = data.records;
|
||||
graph = data.graph;
|
||||
users = data.users;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<ChannelLayout {body} {channel} {user}></ChannelLayout>
|
||||
{#snippet body()}
|
||||
<h3 class="header-small mb-4 mt-5">Latest Content changes</h3>
|
||||
{#if records.length > 0}
|
||||
<div class="table">
|
||||
<table class="">
|
||||
<tbody>
|
||||
{#each records as record (record.id)}
|
||||
<tr>
|
||||
<RecordRow {channel} {graph} {record} {users}
|
||||
></RecordRow>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
@@ -0,0 +1,41 @@
|
||||
<script>
|
||||
import { formatDistanceToNow, parseJSON } from "date-fns";
|
||||
import Avatar from "../../svelte/account/Avatar.svelte";
|
||||
import { previewTitle } from "../../svelte/records/Preview";
|
||||
import Preview from "../../svelte/files/Preview.svelte";
|
||||
import { usernameById } from "../../svelte/account/users";
|
||||
|
||||
let { channel, users, record, graph } = $props();
|
||||
let schema = $derived(
|
||||
channel.schemas.find((s) => s.name === record.schema),
|
||||
);
|
||||
let frieldlyUpdatedAt = formatDistanceToNow(
|
||||
parseJSON(record._sys.updatedAt),
|
||||
{ addSuffix: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<td>
|
||||
<div class="row-name">
|
||||
{#if record.status === "draft"}
|
||||
<span class="status">DRAFT</span>
|
||||
{/if}
|
||||
{#if schema.type === "files"}
|
||||
<!-- <Preview {record} size="tiny" showFilename={true} /> -->
|
||||
{:else}
|
||||
<a href="{channel.lucentUrl}/records/{record.id}">
|
||||
<!-- {previewTitle(channel.schemas, record, graph)} -->
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
<td><a href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a> </td>
|
||||
|
||||
<td>
|
||||
<div style="display: flex;gap: 14px">
|
||||
<Avatar name={usernameById(users, record._sys.updatedBy)} side={24} />
|
||||
<div class="ms-2">
|
||||
{frieldlyUpdatedAt}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
Reference in New Issue
Block a user