Add thead and tbody to every table for svelte 5 compatibility

This commit is contained in:
2024-11-06 19:12:52 +01:00
parent a6880b528a
commit 83ec1fc516
17 changed files with 1452 additions and 1639 deletions

1852
svelte/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,25 +7,25 @@
"dev": "rollup -c -w" "dev": "rollup -c -w"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.20", "@babel/core": "^7.26.0",
"@babel/preset-env": "^7.22.20", "@babel/preset-env": "^7.26.0",
"@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.0", "@rollup/plugin-commonjs": "^26.0.3",
"@rollup/plugin-node-resolve": "^15.2.1", "@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.3", "@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6", "@rollup/plugin-typescript": "^11.1.6",
"@types/jsmediatags": "^3.9.3", "@types/jsmediatags": "^3.9.6",
"rollup": "^4.0.0", "rollup": "^4.24.4",
"rollup-plugin-livereload": "^2.0.0", "rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-svelte": "^7.1.6", "rollup-plugin-svelte": "^7.2.2",
"svelte": "^4.2.0" "svelte": "^4.2.19"
}, },
"dependencies": { "dependencies": {
"behave-js": "^1.5.0", "behave-js": "^1.5.0",
"chart.js": "^4.2.0", "chart.js": "^4.4.6",
"pure-color": "^1.3.0", "pure-color": "^1.3.0",
"rollup-plugin-includepaths": "^0.2.4", "rollup-plugin-includepaths": "^0.2.4",
"svelte-preprocess": "^6.0.2", "svelte-preprocess": "^6.0.3",
"tslib": "^2.7.0" "tslib": "^2.8.1"
} }
} }

View File

@@ -82,6 +82,7 @@ let set_status = async (action, report_type) => {
</div> </div>
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>Time</td> <td>Time</td>
<td>IP</td> <td>IP</td>
@@ -89,6 +90,8 @@ let set_status = async (action, report_type) => {
<td>Status</td> <td>Status</td>
<td colspan="2">Reports from this IP</td> <td colspan="2">Reports from this IP</td>
</tr> </tr>
</thead>
<tbody>
{#each report.reports as user_report} {#each report.reports as user_report}
<tr> <tr>
<td>{formatDate(user_report.time, true, true, false)}</td> <td>{formatDate(user_report.time, true, true, false)}</td>
@@ -118,6 +121,7 @@ let set_status = async (action, report_type) => {
</tr> </tr>
{/if} {/if}
{/each} {/each}
</tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@@ -54,6 +54,7 @@ const toggle_preview = (rep) => {
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td><SortButton field="from_address" active_field={sort_field} asc={asc} sort_func={sort}>Address</SortButton></td> <td><SortButton field="from_address" active_field={sort_field} asc={asc} sort_func={sort}>Address</SortButton></td>
<td><SortButton field="name" active_field={sort_field} asc={asc} sort_func={sort}>Name</SortButton></td> <td><SortButton field="name" active_field={sort_field} asc={asc} sort_func={sort}>Name</SortButton></td>
@@ -63,6 +64,8 @@ const toggle_preview = (rep) => {
<td><SortButton field="created" active_field={sort_field} asc={asc} sort_func={sort}>Created</SortButton></td> <td><SortButton field="created" active_field={sort_field} asc={asc} sort_func={sort}>Created</SortButton></td>
<td></td> <td></td>
</tr> </tr>
</thead>
<tbody>
{#each reporters as rep (rep.from_address)} {#each reporters as rep (rep.from_address)}
<tr animate:flip={{duration: 500}}> <tr animate:flip={{duration: 500}}>
<td>{rep.from_address}</td> <td>{rep.from_address}</td>
@@ -94,6 +97,7 @@ const toggle_preview = (rep) => {
</td> </td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>

View File

@@ -209,6 +209,7 @@ onDestroy(() => {
<section> <section>
<h3>Process stats</h3> <h3>Process stats</h3>
<table> <table>
<tbody>
<tr> <tr>
<td>DB Time</td> <td>DB Time</td>
<td>{formatDate(new Date(status.db_time), true, true, true)}</td> <td>{formatDate(new Date(status.db_time), true, true, true)}</td>
@@ -217,6 +218,7 @@ onDestroy(() => {
<td>PID</td> <td>PID</td>
<td>{status.pid}</td> <td>{status.pid}</td>
</tr> </tr>
</tbody>
</table> </table>
<h3>Pixelstore stats</h3> <h3>Pixelstore stats</h3>

View File

@@ -157,6 +157,7 @@ onMount(get_bans);
</div> </div>
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>Reason</td> <td>Reason</td>
<td>Reporter</td> <td>Reporter</td>
@@ -164,6 +165,8 @@ onMount(get_bans);
<td>Expire time</td> <td>Expire time</td>
<td>File</td> <td>File</td>
</tr> </tr>
</thead>
<tbody>
{#each row.offences as offence (offence.ban_time)} {#each row.offences as offence (offence.ban_time)}
<tr> <tr>
<td>{offence.reason}</td> <td>{offence.reason}</td>
@@ -179,6 +182,7 @@ onMount(get_bans);
</td> </td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>
</Expandable> </Expandable>

View File

@@ -71,12 +71,15 @@ onMount(get_payments);
{#if per_country.NL} {#if per_country.NL}
<table> <table>
<thead>
<tr> <tr>
<td>Bedrag</td> <td>Bedrag</td>
<td>BTW-code</td> <td>BTW-code</td>
<td>BTW</td> <td>BTW</td>
<td>Tegenrekening</td> <td>Tegenrekening</td>
</tr> </tr>
</thead>
<tbody>
<tr> <tr>
<td><Euro amount={per_country.NL.amount + per_country.NL.vat}/></td> <td><Euro amount={per_country.NL.amount + per_country.NL.vat}/></td>
<td>BTW hoog 21%</td> <td>BTW hoog 21%</td>
@@ -95,6 +98,7 @@ onMount(get_payments);
<td><Euro amount={0}/></td> <td><Euro amount={0}/></td>
<td>8030 - Omzet Mollie inkomsten</td> <td>8030 - Omzet Mollie inkomsten</td>
</tr> </tr>
</tbody>
</table> </table>
{/if} {/if}
@@ -103,6 +107,7 @@ onMount(get_payments);
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>Country</td> <td>Country</td>
<td>Payments</td> <td>Payments</td>
@@ -111,6 +116,8 @@ onMount(get_payments);
<td>VAT%</td> <td>VAT%</td>
<td>Total</td> <td>Total</td>
</tr> </tr>
</thead>
<tbody>
{#each Object.entries(per_country) as [country, row]} {#each Object.entries(per_country) as [country, row]}
<tr> <tr>
<td>{country}</td> <td>{country}</td>
@@ -140,12 +147,14 @@ onMount(get_payments);
<td><Euro amount={(totals.vat-per_country.NL.vat)+(totals.amount-per_country.NL.amount)}/></td> <td><Euro amount={(totals.vat-per_country.NL.vat)+(totals.amount-per_country.NL.amount)}/></td>
</tr> </tr>
{/if} {/if}
</tbody>
</table> </table>
</div> </div>
<h3>All payments ({payments.length})</h3> <h3>All payments ({payments.length})</h3>
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>ID</td> <td>ID</td>
<td>Created</td> <td>Created</td>
@@ -155,6 +164,8 @@ onMount(get_payments);
<td>VAT</td> <td>VAT</td>
<td>Total</td> <td>Total</td>
</tr> </tr>
</thead>
<tbody>
{#each payments as row (row.id)} {#each payments as row (row.id)}
<tr> <tr>
<td><a href={row._links.dashboard.href} target="_blank">{row.id}</a></td> <td><a href={row._links.dashboard.href} target="_blank">{row.id}</a></td>
@@ -166,5 +177,6 @@ onMount(get_payments);
<td><Euro amount={row.amount.value*1e6}/></td> <td><Euro amount={row.amount.value*1e6}/></td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>

View File

@@ -140,12 +140,15 @@ onMount(() => {
{#if per_country.NL} {#if per_country.NL}
<h2>Accounting information</h2> <h2>Accounting information</h2>
<table> <table>
<thead>
<tr> <tr>
<td>Bedrag</td> <td>Bedrag</td>
<td>BTW-code</td> <td>BTW-code</td>
<td>BTW</td> <td>BTW</td>
<td>Tegenrekening</td> <td>Tegenrekening</td>
</tr> </tr>
</thead>
<tbody>
<tr> <tr>
<td><Euro amount={per_country.NL.amount + per_country.NL.vat}/></td> <td><Euro amount={per_country.NL.amount + per_country.NL.vat}/></td>
<td>BTW hoog 21%</td> <td>BTW hoog 21%</td>
@@ -164,6 +167,7 @@ onMount(() => {
<td><Euro amount={0}/></td> <td><Euro amount={0}/></td>
<td>8040 - Omzet PayPal inkomsten</td> <td>8040 - Omzet PayPal inkomsten</td>
</tr> </tr>
</tbody>
</table> </table>
{/if} {/if}
@@ -171,6 +175,7 @@ onMount(() => {
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>Country</td> <td>Country</td>
<td>Payments</td> <td>Payments</td>
@@ -181,6 +186,8 @@ onMount(() => {
<td>Fee</td> <td>Fee</td>
<td>Total</td> <td>Total</td>
</tr> </tr>
</thead>
<tbody>
{#each Object.entries(per_country) as [country, row]} {#each Object.entries(per_country) as [country, row]}
<tr> <tr>
<td>{country}</td> <td>{country}</td>
@@ -216,6 +223,7 @@ onMount(() => {
<td><Euro amount={(totals.vat-per_country.NL.vat)+(totals.amount-per_country.NL.amount)-(totals.fee-per_country.NL.fee)}/></td> <td><Euro amount={(totals.vat-per_country.NL.vat)+(totals.amount-per_country.NL.amount)-(totals.fee-per_country.NL.fee)}/></td>
</tr> </tr>
{/if} {/if}
</tbody>
</table> </table>
</div> </div>

View File

@@ -6,6 +6,7 @@ export let row = {}
</script> </script>
<table> <table>
<tbody>
<tr> <tr>
<td>Username</td> <td>Username</td>
<td>{row.user.username}</td> <td>{row.user.username}</td>
@@ -34,10 +35,12 @@ export let row = {}
<td>FS Storage used</td> <td>FS Storage used</td>
<td>{formatDataVolume(row.user.filesystem_storage_used, 3)}</td> <td>{formatDataVolume(row.user.filesystem_storage_used, 3)}</td>
</tr> </tr>
</tbody>
</table> </table>
<br/> <br/>
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>Reason</td> <td>Reason</td>
<td>Reporter</td> <td>Reporter</td>
@@ -45,6 +48,8 @@ export let row = {}
<td>Expire time</td> <td>Expire time</td>
<td>File</td> <td>File</td>
</tr> </tr>
</thead>
<tbody>
{#each row.offences as offence (offence.ban_time)} {#each row.offences as offence (offence.ban_time)}
<tr> <tr>
<td>{offence.reason}</td> <td>{offence.reason}</td>
@@ -60,5 +65,6 @@ export let row = {}
</td> </td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>

View File

@@ -117,6 +117,7 @@ onMount(() => {
<div class="indent"> <div class="indent">
<table> <table>
<tbody>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{file.name}</td> <td>{file.name}</td>
@@ -192,6 +193,7 @@ onMount(() => {
<td>SHA256 hash</td> <td>SHA256 hash</td>
<td style="word-break: break-all;">{file.hash_sha256}</td> <td style="word-break: break-all;">{file.hash_sha256}</td>
</tr> </tr>
</tbody>
</table> </table>
<h2>Views and downloads</h2> <h2>Views and downloads</h2>

View File

@@ -122,6 +122,7 @@ let update_chart = async (base, timespan, interval) => {
<Modal bind:visible={visible} title="Details" width={($nav.base.type === "file" ? 1000 : 750) + "px"}> <Modal bind:visible={visible} title="Details" width={($nav.base.type === "file" ? 1000 : 750) + "px"}>
<table style="width: 100%;"> <table style="width: 100%;">
<tbody>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{$nav.base.name}</td> <td>{$nav.base.name}</td>
@@ -194,6 +195,7 @@ let update_chart = async (base, timespan, interval) => {
</td> </td>
</tr> </tr>
{/if} {/if}
</tbody>
</table> </table>
{#if $nav.base.type === "file"} {#if $nav.base.type === "file"}

View File

@@ -109,36 +109,29 @@ const open_result = index => {
</form> </form>
</div> </div>
<div class="directory center"> <div class="results center">
<tr>
<td></td>
<td>Name</td>
</tr>
{#each search_results as result, index} {#each search_results as result, index}
<a <a
href={"/d"+fs_encode_path(result)} href={"/d"+fs_encode_path(result)}
on:click|preventDefault={() => open_result(index)} on:click|preventDefault={() => open_result(index)}
class="node" class="node"
> >
<td>
<img src={fs_thumbnail_url(result, 32, 32)} class="node_icon" alt="icon"/> <img src={fs_thumbnail_url(result, 32, 32)} class="node_icon" alt="icon"/>
</td> <span class="node_name">
<td class="node_name">
<!-- Remove the search directory from the result --> <!-- Remove the search directory from the result -->
{result.slice($nav.base.path.length+1)} {result.slice($nav.base.path.length+1)}
</td> </span>
</a> </a>
{/each} {/each}
{#if search_results.length === last_limit} {#if search_results.length === last_limit}
<div class="node"> <div class="node">
<td></td> <div class="node_name" style="text-align: center;">
<td class="node_name">
<button on:click={() => {search(last_limit + 100)}}> <button on:click={() => {search(last_limit + 100)}}>
<i class="icon">expand_more</i> <i class="icon">expand_more</i>
More results More results
</button> </button>
</td> </div>
</div> </div>
{/if} {/if}
</div> </div>
@@ -164,8 +157,9 @@ const open_result = index => {
flex: 1 1 auto; flex: 1 1 auto;
} }
.directory { .results {
display: table; display: flex;
flex-direction: column;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
margin: 8px auto 16px auto; margin: 8px auto 16px auto;
@@ -174,17 +168,18 @@ const open_result = index => {
border-collapse: collapse; border-collapse: collapse;
border-radius: 8px; border-radius: 8px;
} }
.directory > * { .results > * {
display: table-row; display: flex;
} flex-direction: row;
.directory > * > * {
display: table-cell;
} }
.node { .node {
display: table-row; display: flex;
flex-direction: row;
align-items: center;
gap: 6px;
text-decoration: none; text-decoration: none;
color: var(--text-color); color: var(--text-color);
padding: 6px; padding: 4px;
} }
.node:not(:last-child) { .node:not(:last-child) {
border-bottom: 1px solid var(--separator); border-bottom: 1px solid var(--separator);
@@ -194,17 +189,15 @@ const open_result = index => {
color: var(--input_text); color: var(--input_text);
text-decoration: none; text-decoration: none;
} }
td {
padding: 4px;
vertical-align: middle;
}
.node_icon { .node_icon {
flex: 0 0 auto;
height: 32px; height: 32px;
width: 32px; width: 32px;
vertical-align: middle; vertical-align: middle;
border-radius: 4px; border-radius: 4px;
} }
.node_name { .node_name {
flex: 1 1 auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
line-height: 1.2em; line-height: 1.2em;

View File

@@ -33,12 +33,15 @@ onMount(async () => {
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>File</td> <td>File</td>
<td>Reason</td> <td>Reason</td>
<td>Ban date</td> <td>Ban date</td>
<td>Expiry date</td> <td>Expiry date</td>
</tr> </tr>
</thead>
<tbody>
{#each result.user_offences as offence (offence.ban_time)} {#each result.user_offences as offence (offence.ban_time)}
<tr> <tr>
<td> <td>
@@ -53,6 +56,7 @@ onMount(async () => {
<td>{formatDate(offence.expire_time, false, false, false)}</td> <td>{formatDate(offence.expire_time, false, false, false)}</td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>
<p> <p>
@@ -95,12 +99,15 @@ onMount(async () => {
<div class="table_scroll"> <div class="table_scroll">
<table> <table>
<thead>
<tr> <tr>
<td>File</td> <td>File</td>
<td>Reason</td> <td>Reason</td>
<td>Ban date</td> <td>Ban date</td>
<td>Expiry date</td> <td>Expiry date</td>
</tr> </tr>
</thead>
<tbody>
{#each result.ip_offences as offence (offence.ban_time)} {#each result.ip_offences as offence (offence.ban_time)}
<tr> <tr>
<td> <td>
@@ -115,6 +122,7 @@ onMount(async () => {
<td>{formatDate(offence.expire_time, false, false, false)}</td> <td>{formatDate(offence.expire_time, false, false, false)}</td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
</div> </div>

View File

@@ -51,9 +51,11 @@ export let icon_href = ""
<IconBlock icon_href={icon_href}> <IconBlock icon_href={icon_href}>
<table> <table>
<tbody>
<tr><td colspan="2">{file_name}</td></tr> <tr><td colspan="2">{file_name}</td></tr>
<tr><td>Type</td><td>{file_type}</td></tr> <tr><td>Type</td><td>{file_type}</td></tr>
<tr><td>Size</td><td>{formatDataVolume(file_size, 3)}</td></tr> <tr><td>Size</td><td>{formatDataVolume(file_size, 3)}</td></tr>
</tbody>
</table> </table>
<button on:click={() => {dispatch("download")}}> <button on:click={() => {dispatch("download")}}>
<i class="icon">download</i> Download <i class="icon">download</i> Download

View File

@@ -117,6 +117,7 @@ const logout = async (key) => {
</section> </section>
<div class="table_scroll"> <div class="table_scroll">
<table style="text-align: left;"> <table style="text-align: left;">
<thead>
<tr> <tr>
<td>Key</td> <td>Key</td>
<td>Created</td> <td>Created</td>
@@ -124,6 +125,8 @@ const logout = async (key) => {
<td>IP address</td> <td>IP address</td>
<td></td> <td></td>
</tr> </tr>
</thead>
<tbody>
{#each rows as row (row.auth_key)} {#each rows as row (row.auth_key)}
<tr style="border-bottom: none;"> <tr style="border-bottom: none;">
<td>{row.auth_key}</td> <td>{row.auth_key}</td>
@@ -157,6 +160,7 @@ const logout = async (key) => {
<td colspan="4">User-Agent: {row.user_agent}</td> <td colspan="4">User-Agent: {row.user_agent}</td>
</tr> </tr>
{/each} {/each}
</tbody>
</table> </table>
<br/> <br/>
</div> </div>

View File

@@ -117,6 +117,7 @@ onMount(() => {
</div> </div>
<table> <table>
<tbody>
<tr> <tr>
<td>Opening balance</td> <td>Opening balance</td>
<td><Euro amount={transactions.balance_start} precision="4"/></td> <td><Euro amount={transactions.balance_start} precision="4"/></td>
@@ -151,6 +152,7 @@ onMount(() => {
<td>Deposited</td> <td>Deposited</td>
<td><Euro amount={transactions.total_deposited} precision="4"/></td> <td><Euro amount={transactions.total_deposited} precision="4"/></td>
</tr> </tr>
</tbody>
</table> </table>
<style> <style>

View File

@@ -0,0 +1,56 @@
<script>
import Button from "../layout/Button.svelte";
// {icon: "", label: ""}
export let tabs = []
export let active = 0
export const open_tab = (name = "") => {
for (let i = 0; i < tabs.length; i++) {
if (tabs[i].name === name) {
active = i
return
}
}
}
</script>
<div class="tab_bar">
{#each tabs as t, i}
<Button
icon={t.icon}
label={t.label}
highlight={i === active}
click={() => active = i}
/>
{/each}
</div>
<!-- Can't find a way to do this dynamically unfortunately-->
{#if active === 0}
<slot name="0"></slot>
{:else if active === 1}
<slot name="1"></slot>
{:else if active === 2}
<slot name="2"></slot>
{:else if active === 3}
<slot name="3"></slot>
{:else if active === 4}
<slot name="4"></slot>
{:else if active === 5}
<slot name="5"></slot>
{:else if active === 6}
<slot name="6"></slot>
{:else if active === 7}
<slot name="7"></slot>
{:else if active === 8}
<slot name="8"></slot>
{:else if active === 9}
<slot name="9"></slot>
{/if}
<style>
.tab_bar {
border-bottom: 2px solid var(--separator);
}
</style>