mirror of
https://github.com/psforever/PSFPortal.git
synced 2026-07-16 00:44:40 +00:00
Application improvements
* Change favicon * Display account banned status on admin search * Pull in application version from Webpack * Add "Feedback" button in footer and github references * Fix faction icons to make them the same size * PaginatedList component now supports back * Tabbed navs support back * Hide Pagination when only one page * Improve admin table style and size
This commit is contained in:
parent
817796e181
commit
fa6e168ccc
23 changed files with 244 additions and 158 deletions
|
|
@ -3,14 +3,19 @@
|
|||
export let character;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<span class="character-link">
|
||||
<span class="faction-icon">
|
||||
{#if character.faction_id == 1}
|
||||
<img height=24 src="/img/nc_icon.png" alt="NC" />
|
||||
<img height=32 src="/img/nc_icon.png" alt="NC" />
|
||||
{:else if character.faction_id == 0}
|
||||
<img height=32 src="/img/tr_icon.png" alt="TR" />
|
||||
{:else if character.faction_id == 2}
|
||||
<img height=32 src="/img/vs_icon.png" alt="VS" />
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
{#if $isAdmin}
|
||||
<a href="/user/{character.account_id}">{character.name}</a>
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@
|
|||
|
||||
<PaginatedList {fetch} let:data={logins} let:pagination={pagination}>
|
||||
<p slot="header">
|
||||
{#if pagination.item_count}
|
||||
Login data
|
||||
{:else}
|
||||
No logins yet
|
||||
{#if !pagination.item_count}
|
||||
No logins yet.
|
||||
{/if}
|
||||
</p>
|
||||
<table slot="body" class="table table-dark table-responsive">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import Pagination from '../components/Pagination'
|
||||
|
||||
export let setURLParam = false;
|
||||
export let URLSearchName = 'page';
|
||||
export let fetch;
|
||||
|
||||
let data;
|
||||
|
|
@ -18,8 +19,9 @@
|
|||
const url = new URL(window.location.href)
|
||||
let initialPage = 1;
|
||||
|
||||
console.log(setURLParam, URLSearchName)
|
||||
if (setURLParam) {
|
||||
let param = parseInt(url.searchParams.get('page'))
|
||||
let param = parseInt(url.searchParams.get(URLSearchName))
|
||||
|
||||
if (param != NaN)
|
||||
initialPage = param;
|
||||
|
|
@ -32,6 +34,13 @@
|
|||
if (pagination.page == page || fetching)
|
||||
return
|
||||
|
||||
if (setURLParam) {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set(URLSearchName, page);
|
||||
history.replaceState(null, null,
|
||||
url.pathname + url.search + url.hash)
|
||||
}
|
||||
|
||||
await list_fetch(page);
|
||||
}
|
||||
|
||||
|
|
@ -56,9 +65,15 @@
|
|||
{#if data}
|
||||
<slot name="header" data={data} pagination={pagination}></slot>
|
||||
{#if pagination.item_count > 0}
|
||||
<Pagination {pagination} {pageChange} {setURLParam} />
|
||||
<slot name="body" data={data} pagination={pagination}></slot>
|
||||
<Pagination {pagination} {pageChange} {setURLParam} />
|
||||
{#if pagination.page_count > 1}
|
||||
<Pagination {pagination} {pageChange} {setURLParam} {URLSearchName} />
|
||||
{/if}
|
||||
|
||||
<slot name="body" data={data} pagination={pagination}></slot>
|
||||
|
||||
{#if pagination.page_count > 1}
|
||||
<Pagination {pagination} {pageChange} {setURLParam} {URLSearchName} />
|
||||
{/if}
|
||||
{/if}
|
||||
<slot name="footer" data={data} pagination={pagination}></slot>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<script>
|
||||
import page from 'page'
|
||||
export let pagination;
|
||||
export let pageChange;
|
||||
export let setURLParam = false;
|
||||
|
||||
export let URLSearchName = 'page';
|
||||
export let displayPages = 10;
|
||||
|
||||
let pages = []
|
||||
|
||||
function pageClick(event) {
|
||||
const page = event.target.getAttribute('data-page');
|
||||
pageChange(parseInt(page))
|
||||
|
||||
if (!setURLParam)
|
||||
event.preventDefault()
|
||||
const target_page = parseInt(event.target.getAttribute('data-page'));
|
||||
event.preventDefault()
|
||||
pageChange(target_page)
|
||||
}
|
||||
|
||||
$ : {
|
||||
|
|
@ -66,8 +66,8 @@
|
|||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li class="page-item" class:disabled={pagination.page<=1}>
|
||||
<a class="page-link" href={"?page="+(pagination.page-1)}
|
||||
on:click={pageClick}
|
||||
<a class="page-link" href="?{URLSearchName}={pagination.page-1}"
|
||||
on:click|preventDefault={pageClick}
|
||||
data-page={pagination.page-1}
|
||||
aria-label="Previous">
|
||||
«
|
||||
|
|
@ -78,14 +78,14 @@
|
|||
<li class="page-item page-last-separator disabled"><span class="page-link">...</span></li>
|
||||
{:else}
|
||||
<li class="page-item" class:active={page==pagination.page}>
|
||||
<a on:click={pageClick} href={"?page="+page} data-page={page} class="page-link">{page}</a>
|
||||
<a on:click|preventDefault={pageClick} href="?{URLSearchName}={page}" data-page={page} class="page-link">{page}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
<li class="page-item" class:disabled={pagination.page>=pagination.page_count}>
|
||||
<a class="page-link" href={"?page="+(pagination.page+1)}
|
||||
<a class="page-link" href="?{URLSearchName}={pagination.page+1}"
|
||||
data-page={pagination.page+1}
|
||||
on:click={pageClick}
|
||||
on:click|preventDefault={pageClick}
|
||||
aria-label="Next">
|
||||
»
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue