Skip to content

Commit

Permalink
Merge branch 'main' into JoeKarow/hacktoberfest2024
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow authored Oct 2, 2024
2 parents 49d269c + b5d4860 commit 046d1a2
Show file tree
Hide file tree
Showing 9 changed files with 1,407 additions and 837 deletions.
1,374 changes: 1,374 additions & 0 deletions src/app/monthlychallenges/(challenges)/nov-2022/data.json

Large diffs are not rendered by default.

31 changes: 21 additions & 10 deletions src/app/monthlychallenges/(challenges)/nov-2022/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import React, { Fragment } from 'react';
import slugify from '@sindresorhus/slugify';
import { createMetaData } from '@/util/createMetaData.server';
import { CmsActions } from '@/util/api/cms.server';
import type {
NovemberChallengeEntryAuthor,
NovemberChallengeEntry,
} from '@/util/api/types';
import DefaultLayout from '@/components/layouts/DefaultLayout';
import data from './data.json';

type NovemberChallengeEntryAuthor = {
id: string | number;
fullName?: string | null;
userYourName?: string | null;
};

type NovemberChallengeEntry = {
title: string;
shortDescriptionMarkDown?: string | null;
id?: number | string;
urlValue: string;
wordCount: number;
topics?: string | null;
date: string;
author: NovemberChallengeEntryAuthor;
};

const handle = {
listTitle: 'November, 2022: 100k words!',
Expand Down Expand Up @@ -55,11 +68,7 @@ const goals = [
async function getData() {
const { title } = handle.meta;

let api = new CmsActions();

const posts = await api.getNovemberChallengeEntries({
year: 2022,
});
const posts: NovemberChallengeEntry[] = data;

let totalWordCount = 0;

Expand Down Expand Up @@ -102,6 +111,7 @@ async function getData() {
const description = `Current status: ${totalWordCount.toLocaleString()} out of ${currentGoal?.title} words`;

return {
posts,
// ...blog,
totalWordCount,
totalPosts,
Expand All @@ -125,6 +135,7 @@ export default async function Challenge() {
completedGoals,
currentGoal,
meta,
posts,
} = await getData();

return (
Expand Down
8 changes: 6 additions & 2 deletions src/data/mocks/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export function createEventsData({
rangeStart: string;
rangeEnd: string;
}) {
const dates = faker.date.betweens(rangeStart, rangeEnd, limit);
const dates = faker.date.betweens({
from: rangeStart,
to: rangeEnd,
count: limit,
});

return dates.map((date) => {
const startDate = DateTime.fromJSDate(date);
Expand All @@ -23,7 +27,7 @@ export function createEventsData({
});

return {
id: faker.datatype.uuid(),
id: faker.string.uuid(),
title: faker.lorem.sentence(7),
startDateLocalized: startDate.toUTC().toString(),
endDateLocalized: startDate.toUTC().plus({ hours: 1 }).toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/data/mocks/memberData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/data/mocks/podcast.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export function getEpisodes({ limit = 5 }) {
return new Array(limit).fill(null).map((_, i) => {
const episode = limit - i;
const season = 1;
const name = faker.name.fullName();
const name = faker.person.fullName();

return {
title: `${name} - ${faker.lorem.words(4)}`,
slug: `0${season}${episode < 10 ? '0' + episode : episode}-${slugify(
name,
)}`,
id: faker.datatype.uuid(),
id: faker.string.uuid(),
metaDescription: `Season ${season}, Episode ${episode} of the Virtual Coffee Podcast`,
podcastEpisode: episode,
podcastSeason: season,
Expand All @@ -29,7 +29,7 @@ export function getEpisodes({ limit = 5 }) {

export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
const today = DateTime.now();
const name = faker.name.fullName();
const name = faker.person.fullName();
const season = parseInt(slug.slice(0, 2));
const episode = parseInt(slug.slice(2, 4));

Expand All @@ -38,7 +38,7 @@ export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
slug: `0${season}${episode < 10 ? '0' + episode : episode}-${slugify(
name,
)}`,
id: faker.datatype.uuid(),
id: faker.string.uuid(),
metaDescription: `Season ${season}, Episode ${episode} of the Virtual Coffee Podcast`,
podcastEpisode: episode,
podcastSeason: season,
Expand All @@ -52,7 +52,7 @@ export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
},
podcastGuests: [
{
id: faker.datatype.uuid(),
id: faker.string.uuid(),
guestName: name,
guestBio: {
renderHtml: `<p>${faker.lorem.sentence()}</p>`,
Expand Down
Loading

0 comments on commit 046d1a2

Please sign in to comment.