Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove about page #173

Merged
merged 3 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 33 additions & 27 deletions app/components/ui/post-info-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
import { Link } from '@remix-run/react'
import moment from 'moment'
import invariant from 'tiny-invariant'
import { effectSizeOnTarget } from '#app/repositories/ranking.ts'
import { type PostState, type Post } from '#app/types/api-types.ts'

const effectSizeThresholds: number[] = [0.1, 0.3, 0.5, 0.7, 0.9]

function convincingnessScale(effectSize: number): string {
let numberOfFlames = 0

for (let i = 0; i < effectSizeThresholds.length; i++) {
const threshold = effectSizeThresholds[i]
invariant(threshold !== undefined)
if (effectSize < threshold) {
break
}
numberOfFlames++
}

return '🔥'.repeat(numberOfFlames)
}

export function PostInfoBar({
post,
postState,
Expand All @@ -12,36 +31,23 @@ export function PostInfoBar({
const ageString = moment(post.createdAt).fromNow()
const effectSize = effectSizeOnTarget(postState.effectOnTargetPost)

invariant(effectSizeThresholds[0] !== undefined)

return (
<>
<div className="mb-1 flex w-full items-center gap-2 text-xs sm:items-baseline">
{postState.effectOnTargetPost !== null && (
<span title="Convincingness Score. How much this post changed people's opinion on the target post.">
<span className="opacity-50">{(effectSize * 100).toFixed(0)}%</span>{' '}
{convincingnessScale(effectSize)}
<Link to={`/stats/${post.id}`}>
<div className="mb-1 flex w-full items-center gap-2 text-xs sm:items-baseline">
{effectSize > effectSizeThresholds[0] && (
<span title="Convincingness Score. How much this post changed people's opinion on the target post.">
{convincingnessScale(effectSize)}
</span>
)}
<span className="opacity-50">
{postState.voteCount} {postState.voteCount == 1 ? 'vote' : 'votes'}
</span>
)}
<span className="opacity-50">{ageString}</span>
<span className="opacity-50">
{postState.voteCount} {postState.voteCount == 1 ? 'vote' : 'votes'}
</span>
</div>
<span className="opacity-50">{ageString}</span>
</div>
</Link>
</>
)
}

function convincingnessScale(effectSize: number): string {
if (effectSize < 0.1) {
return ''
} else if (effectSize < 0.3) {
return '🔥'
} else if (effectSize < 0.5) {
return '🔥🔥'
} else if (effectSize < 0.7) {
return '🔥🔥🔥'
} else if (effectSize < 0.9) {
return '🔥🔥🔥🔥'
} else {
return '🔥🔥🔥🔥🔥'
}
}
23 changes: 0 additions & 23 deletions app/routes/_marketing+/about.tsx

This file was deleted.