Skip to content

Commit

Permalink
Adding new adstxt queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Jan 29, 2025
1 parent 36edacc commit 4bef613
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
60 changes: 60 additions & 0 deletions frontend/src/lib/AdsTxtPubIDsTable.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script lang="ts">
import Pagination from './Pagination.svelte';
import { DataHandler } from '@vincjo/datatables/legacy/remote';
import type { State } from '@vincjo/datatables/legacy/remote';
import type { AdsTxtEntries } from '../types';
interface Props {
entries_table: AdsTxtEntries[];
}
let { entries_table }: Props = $props();
const totalRows = entries_table.length;
const rowsPerPage = 50;
const handler = new DataHandler<AdsTxtEntries>([], {
rowsPerPage: rowsPerPage,
totalRows: totalRows
});
const rows = handler.getRows();
handler.onChange((state: State) =>
Promise.resolve(
entries_table.slice(
0 + (state.pageNumber - 1) * state.rowsPerPage,
state.rowsPerPage * state.pageNumber
)
)
);
handler.invalidate();
</script>

<div class="table-container space-y-4">
<div class="overflow-x-auto pl-0">
<table class="table table-hover table-compact table-auto w-full">
<thead>
<tr>
<th class="table-cell-fit">Publisher ID</th>
<th class="table-cell-fit">Related Apps</th>
</tr>
</thead>
<tbody>
{#each $rows as row}
<tr>
<td class="table-cell-fit text-sm md:text-base max-w-[100px] truncate">
<!-- <a href={`/ads-txt/unrulymedia.com/${row.publisher_id}`}>{row.publisher_id}</a> -->
{row.publisher_id}
</td>
<td class="table-cell-fit text-sm md:text-base">
{row.app_count}
</td>
</tr>
{/each}
</tbody>
</table>
</div>
</div>
70 changes: 70 additions & 0 deletions frontend/src/lib/AdsTxtTotalsBox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script lang="ts">
function formatNumber(num: number) {
return new Intl.NumberFormat('en-US').format(num);
}
let { myTotals } = $props();
</script>

<hr />

<div class="text-md text-primary-800-200 uppercase tracking-wide">Ads.txt DIRECT Totals</div>
<div class="grid grid-cols-2 gap-4 p-4">
<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">Android Pub IDs</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.google.direct.publisher_id_count)}
</div>
</div>

<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">iOS Pub IDs</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.apple.direct.publisher_id_count)}
</div>
</div>

<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">Android Developers</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.google.direct.developer_count)}
</div>
</div>

<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">iOS Developers</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.apple.direct.developer_count)}
</div>
</div>

<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">Android Apps</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.google.direct.app_count)}
</div>
</div>

<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">iOS Apps</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.apple.direct.app_count)}
</div>
</div>
</div>
<hr />
<div class="text-md text-primary-800-200 uppercase tracking-wide">Ads.txt RESELLER Totals</div>
<div class="grid grid-cols-2 gap-4 p-4">
<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">Android Apps</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.google.reseller.app_count)}
</div>
</div>
<div class="stat-container">
<div class="text-sm text-primary-800-200 uppercase tracking-wide">iOS Apps</div>
<div class="text-2xl font-bold text-primary-900">
{formatNumber(myTotals.apple.reseller.app_count)}
</div>
</div>
</div>

0 comments on commit 4bef613

Please sign in to comment.