Compare commits

...

9 Commits
0.2.4 ... 0.3.0

Author SHA1 Message Date
Nicolai Ort 5f81f55987 🚀RELEASE 0.3.0
continuous-integration/drone/push Build is passing Details
2021-08-21 10:19:12 +02:00
Nicolai Ort 8bcab4661b
Added safeguard for random updates 2021-08-21 10:18:47 +02:00
Nicolai Ort f2ec82762e
Fixed link to details 2021-08-21 10:17:52 +02:00
Nicolai Ort 0327bdc7a0
Enabled y scrolling (whyever that was disabled...) 2021-08-21 10:17:02 +02:00
Nicolai Ort b3b6731c09
Fixed typo in visits query 2021-08-21 10:15:39 +02:00
Nicolai Ort 36de0a3eb3
Added visits overview to sidebar 2021-08-21 10:13:37 +02:00
Nicolai Ort 839c658075
Added apiclient method 2021-08-21 10:12:06 +02:00
Nicolai Ort 12aa8eeb3e
Missing copy-paste :D 2021-08-21 10:11:05 +02:00
Nicolai Ort b655ff2372
Added new "visits" page 2021-08-21 10:10:51 +02:00
7 changed files with 128 additions and 4 deletions

View File

@ -2,8 +2,22 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### [0.3.0](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.4...0.3.0)
- Added new "visits" page [`b655ff2`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/b655ff2372655d1fb7fa6cea8a10b193805f315c)
- Added visits overview to sidebar [`36de0a3`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/36de0a3eb305317c829bace18a9661308c8cf0f3)
- Added apiclient method [`839c658`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/839c65807524646c1c6a677f10042988fb2bccdf)
- Added safeguard for random updates [`8bcab46`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/8bcab4661bec3c748cc65078e5187d936be9cdf9)
- Fixed link to details [`f2ec827`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/f2ec82762e9bc107f29952709555bc3d893def49)
- Enabled y scrolling (whyever that was disabled...) [`0327bdc`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/0327bdc7a0cefda343168c911faa51cd42271673)
- Fixed typo in visits query [`b3b6731`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/b3b6731c09d47fff9df96903c75914e7042e28c5)
- Missing copy-paste :D [`12aa8ee`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/12aa8eeb3e345ccee10bdb6abca93c5fd84a071a)
#### [0.2.4](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.3...0.2.4)
> 21 August 2021
- 🚀RELEASE 0.2.4 [`58adc65`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/58adc6511aa1ee573abcf21a176131bf10354747)
- Fixed logout redirect [`29c4b00`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/29c4b0013abb0466f59239ae3717f60216cecc1f)
- Fixed details link [`8ed16ad`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/8ed16adeffed9e1368615caf6022d8a376337b8a)

View File

@ -1,6 +1,6 @@
{
"name": "@odit/linkylinky-dashboard",
"version": "0.2.4",
"version": "0.3.0",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",

View File

@ -62,6 +62,18 @@ export default class Apiclient {
).data;
}
/**
* API-Getter for the linkylinky api all vists endpoint (needs auth)
* @returns Url visit details for each visit in an array of objects.
*/
static async getVisits() {
return (
await axios.get(`https://kauft.es/api/visits`, {
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).data;
}
/**
* API-Delet for the linkylinky api url deletion endpoint (needs auth)
* @param {*} shortcode The shortcode of your most hated url

View File

@ -85,6 +85,33 @@
<span class="mx-4 font-medium">Manage Links</span>
</a>
<a
class="flex items-center px-4 py-2 mt-5 text-gray-600 transition-colors duration-200 transform rounded-md dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 dark:hover:text-gray-200 hover:text-gray-700"
href="./visits"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
/>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
/>
</svg>
<span class="mx-4 font-medium">All Visits</span>
</a>
<!-- <a
class="flex items-center px-4 py-2 mt-5 text-gray-600 transition-colors duration-200 transform rounded-md dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 dark:hover:text-gray-200 hover:text-gray-700"
@ -162,7 +189,9 @@
src="https://images.unsplash.com/photo-1531427186611-ecfd6d936c79?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80"
alt="avatar"
/>
<h4 class="mx-2 font-medium text-gray-800 dark:text-gray-200 hover:underline">Username here</h4>
<h4 class="mx-2 font-medium text-gray-800 dark:text-gray-200 hover:underline">
Username here
</h4>
</div>
{/if}
</div>

View File

@ -25,7 +25,7 @@
<div style="min-height: 640px;" class="bg-white dark:bg-gray-800">
<div class="h-screen flex overflow-hidden">
<Sidebar />
<div class="px-4 py-8 flex flex-col w-0 flex-1 overflow-hidden">
<div class="px-4 py-8 flex flex-col w-0 flex-1 overflow-y-scroll">
<slot />
</div>
</div>

View File

@ -8,7 +8,7 @@
// Yes i know this isn't the best way to implement this, but linkylinky dashboard is just a oneshot sideproject r/n.
const unsubscribe = UserStore.subscribe((value) => {
if (value.isLoggedIn) {
if (value.isLoggedIn && urls.length == 0) {
urlQuery = Apiclient.getUrls().then((res) => {
urls = res;
});

69
src/routes/visits.svelte Normal file
View File

@ -0,0 +1,69 @@
<script>
import Apiclient from '$lib/Apiclient';
import UserStore from '$lib/UserStore';
import { onDestroy } from 'svelte';
$: visits = [];
let visitQuery;
// Yes i know this isn't the best way to implement this, but linkylinky dashboard is just a oneshot sideproject r/n.
const unsubscribe = UserStore.subscribe((value) => {
if (value.isLoggedIn && visits.length == 0) {
visitQuery = Apiclient.getVisits().then((res) => {
visits = res;
});
}
});
onDestroy(unsubscribe);
</script>
<h2 class="text-3xl font-bold text-gray-800 dark:text-gray-100 pb-6">View all visits</h2>
<div class="rounded-xl">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
Shortcode
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
Provider
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
Timestamp
</th>
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:text-gray-100" x-max="1">
{#await visitQuery}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
Loading data...
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> Loading data... </td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> Loading data... </td>
</tr>
{:then}
{#each visits as visit}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
{#if visit.provider == "native"}
<a href={`./details?shortcode=${visit.shortcode}`}>{visit.shortcode}</a>
{:else}
{visit.shortcode}
{/if}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
{visit.provider}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> {visit.timestamp} </td>
</tr>
{/each}
{/await}
</tbody>
</table>
</div>