Skip to content

Conversation

@JamesPeck
Copy link
Collaborator

@JamesPeck JamesPeck commented Oct 15, 2025

Requires db migrations: #8

@JamesPeck JamesPeck added the enhancement New feature or request label Oct 15, 2025
<div class="w-2/4">
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html sanitizeHTML(description)}
{@html browser ? sanitizeHTML(description) : description}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{@html browser ? sanitizeHTML(description) : description}
{@html browser ? sanitizeHTML(description) : ''}

Probably, if the page isn't loaded in browser yet, just return an empty string or placeholder text. Right now, we're using safe text from our config file but conceivably, we could move this stuff to a database where we'll want output sanitization in case of database corruption.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for SSR to render it

Comment on lines +10 to +22
const isStatsMatching = $derived(() => {
if ($authStats.length === 0 || $stats.length === 0) return false;
const publicLabelsByKey = new Map($stats.map((s) => [s.key, s.label]));
const authKeys = new Set($authStats.map((s) => s.key));
return (
$authStats.every((s) => publicLabelsByKey.get(s.key) === s.label) &&
$stats.every((s) => authKeys.has(s.key))
);
});
import Stat from './Stat.svelte';
const showPublicStats = $derived(
($stats.length > 0 && !isStatsMatching) || $authStats.length === 0,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because in nhanes public and logged in stats are the same and always will be.

{/if}

{#if $stats.length > 0}
{#if showPublicStats}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell, does this still show public stats after a user is logged in? It should show both their authenticated stats and the public stats after login.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public stats are not impacted by logged in status... unless they match the auth stats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants