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

Add debug, un-hide ping #89

Merged
merged 4 commits into from
Dec 30, 2023
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
4 changes: 2 additions & 2 deletions components/data/OnlineStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const OnlineStatus: FC<Props> = ({ item }) => {
}

return (
<div style={{ display: 'none' }}>
<>
<span
className={style}
onClick={() => setShow(true)}
Expand All @@ -64,7 +64,7 @@ const OnlineStatus: FC<Props> = ({ item }) => {
close={() => setShow(false)}
/>
)}
</div>
</>
)
}

Expand Down
6 changes: 4 additions & 2 deletions lib/db/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function getLastViews(type: Types, n: number) {
.limit(n)
.toArray()
)
console.log('Found', data.length, 'entries in views table for', type)

// count what has been popular recently
let accumulated = {}
Expand All @@ -51,8 +52,9 @@ export async function getLastViews(type: Types, n: number) {
await Promise.all(
sorted.map(async (s) => {
const data = await findOneTyped(type, s.contentId)

data.views = s.count
if (data !== null) {
data.views = s.count
}
return data
})
)
Expand Down
5 changes: 3 additions & 2 deletions pages/item/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Column } from '../../types/Column'
import { Collection } from '../../types/Collection'
import DeleteButton from '../../components/buttons/DeleteButton'
import { faStar } from '@fortawesome/free-solid-svg-icons/faStar'
import { findOneTyped, getAllTyped } from '../../lib/db/dbTyped'

type Props = {
item: Item
Expand Down Expand Up @@ -359,7 +360,7 @@ const Item: FC<Props> = ({ item, columns, collections }) => {
export default Item

export async function getStaticPaths() {
const items = await getItems()
const items = await getAllTyped(Types.item)
const paths = items.map((i) => {
return {
params: {
Expand All @@ -375,7 +376,7 @@ export async function getStaticPaths() {
}

export async function getStaticProps({ params }) {
const item = await getItem(params.id)
const item = await findOneTyped(Types.item, params.id) as Item
if (!item) {
return {
notFound: true,
Expand Down
Loading