From 7efe4adfcd32bb097dcf4a93b8649aac0b0b1907 Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:12:23 -0500 Subject: [PATCH 01/10] Use the util for time range --- src/app/lib/persistence.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/lib/persistence.ts b/src/app/lib/persistence.ts index aa99d0b..1eca13d 100644 --- a/src/app/lib/persistence.ts +++ b/src/app/lib/persistence.ts @@ -7,15 +7,17 @@ import db from "../db"; import { hasAi } from "../utils/string"; import { Post as PostType } from "../types"; import { Prisma } from "@prisma/client"; +import { getStartAndEndOfDayInUTC } from "../utils/date"; export async function getTodaysLaunches() { + const { postedAfter, postedBefore } = getStartAndEndOfDayInUTC(); const posts = ( await db.post.findMany({ where: { // only get the posts that are the same day as today createdAt: { - gte: new Date(new Date().setHours(0, 0, 0, 0)), - lt: new Date(new Date().setHours(23, 59, 59, 999)), + gte: postedAfter, + lt: postedBefore, }, deleted: false, }, From a6c868407db5df43e47305db5f0668a58b60bdd1 Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:16:52 -0500 Subject: [PATCH 02/10] Hide tooltip --- src/app/component/SlopMeter.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/component/SlopMeter.tsx b/src/app/component/SlopMeter.tsx index e1c62fa..d71bf14 100644 --- a/src/app/component/SlopMeter.tsx +++ b/src/app/component/SlopMeter.tsx @@ -74,6 +74,7 @@ export const SlopMeter: React.FC = ({ propA, propB, nameA, nameB, .select("body") .append("div") .style("pointer-events", "none") + .style("opacity", 0) .classed( "absolute border border-[#434343] rounded p-1.5 bg-neutral-200 dark:border-neutral-200 dark:bg-[#111111]", true, From c9e949c11be96a79a7d97a9eb5231bc1585368ed Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 24 Aug 2024 20:21:19 -0500 Subject: [PATCH 03/10] moar people (#91) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ff28550..344be38 100644 --- a/README.md +++ b/README.md @@ -40,5 +40,7 @@ Please feel free to check out our [architecture diagram](./public/og-hunt-diagra - System Architect: [Max](https://github.com/maxdemaio) - Data Scientist: [TypeSafe](https://github.com/typesafeui) - Data Visualization: [Nathan](https://github.com/nathanroark) +- Senior Lead Frontend Developer: [Jean](https://github.com/Kampouse) +- Human Resources: [Metalface](https://github.com/metal-face) - Scrum Leader: [Aodhan](https://github.com/MVAodhan) - Civil Engineering Lead: [Mark](https://github.com/markkhoo) From 4ab000e37d3517e8a51483714e63fe65dcda4647 Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:58:55 -0500 Subject: [PATCH 04/10] Add star Fix #44 --- src/app/component/SlopMeter.tsx | 5 ++- src/app/globals.css | 66 ++++++++++++++++++++++++++++++++- src/app/page.tsx | 12 +++++- src/app/utils/string.ts | 5 +++ 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/app/component/SlopMeter.tsx b/src/app/component/SlopMeter.tsx index d71bf14..7d1df1f 100644 --- a/src/app/component/SlopMeter.tsx +++ b/src/app/component/SlopMeter.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useEffect, useRef, useState } from "react"; import * as d3 from "d3"; +import { formatNumber } from "../utils/string"; const useResizeObserver = (ref: React.RefObject) => { const [width, setWidth] = useState(null); @@ -132,7 +133,7 @@ export const SlopMeter: React.FC = ({ propA, propB, nameA, nameB, .attr("text-anchor", "start") .attr("fill", "black") .style("font-weight", "bold") - .text(nameA + " • " + propA); + .text(nameA + " • " + formatNumber(propA)); // Text B (Label on the right side) svg @@ -141,7 +142,7 @@ export const SlopMeter: React.FC = ({ propA, propB, nameA, nameB, .attr("y", height / 2 + 5) .attr("text-anchor", "end") .classed("font-bold dark:fill-neutral-200 fill-black", true) - .text(propB + " • " + nameB); + .text(formatNumber(propB) + " • " + nameB); // Clean up the tooltip on component unmount return () => { diff --git a/src/app/globals.css b/src/app/globals.css index f8ff8df..a1426b1 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -18,8 +18,7 @@ body { color: rgb(var(--foreground-rgb)); - background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) - rgb(var(--background-start-rgb)); + background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb)); } @layer utilities { @@ -27,3 +26,66 @@ body { text-wrap: balance; } } +/* TODO: someone cook this in tailwind */ +.fancy { + --offset: 2px; + background: #000; + border-radius: 50px; + position: relative; + height: 50px; + color: #fff; + text-align: center; + width: 300px; + max-width: 100%; + overflow: hidden; +} + +.fancy div { + background: transparent; + color: white; + font-size: 1.25rem; + position: absolute; + inset: 0; + display: flex; + font-weight: 700; + align-items: center; + justify-content: center; + z-index: 10; +} + +/* Conic gradient */ +.fancy::before { + content: ""; + background: conic-gradient( + #fda4af 0% 25%, + #fb923c 75% 100% + ); + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + aspect-ratio: 1; + width: 100%; + animation: rotate 2s linear infinite; +} + +/* Overlay */ +.fancy::after { + content: ""; + background: inherit; + border-radius: inherit; + position: absolute; + inset: var(--offset); + height: calc(100% - 2 * var(--offset)); + width: calc(100% - 2 * var(--offset)); +} + +@keyframes rotate { + from { + transform: translate(-50%, -50%) scale(1.4) rotate(0turn); + } + + to { + transform: translate(-50%, -50%) scale(1.4) rotate(1turn); + } +} diff --git a/src/app/page.tsx b/src/app/page.tsx index e8e0b1a..133b148 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -41,10 +41,18 @@ export default async function Page() { return (
-
+

Product Hunt with ZERO AI Slop™

+ +
✨ Star on Github
+

SlopMeter™

@@ -76,7 +84,7 @@ export default async function Page() {
{posts.map((post, index) => ( - + ))}
diff --git a/src/app/utils/string.ts b/src/app/utils/string.ts index aeb50ed..2be6617 100644 --- a/src/app/utils/string.ts +++ b/src/app/utils/string.ts @@ -38,3 +38,8 @@ export const hasAi = ( export const filterPosts = (posts: ProductPost[], showOnlyAi = false): ProductPost[] => { return posts.filter((post) => hasAi(post, showOnlyAi)); }; + +export const formatNumber = (num: number): string => { + const formatter = Intl.NumberFormat("en", { notation: "compact" }); + return formatter.format(num); +}; From 47fd10c5df89f7c5958d963b33a05b46599c514b Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 24 Aug 2024 20:59:06 -0500 Subject: [PATCH 05/10] Format --- src/app/globals.css | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/globals.css b/src/app/globals.css index a1426b1..1fa2271 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -18,7 +18,8 @@ body { color: rgb(var(--foreground-rgb)); - background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb)); + background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) + rgb(var(--background-start-rgb)); } @layer utilities { @@ -56,10 +57,7 @@ body { /* Conic gradient */ .fancy::before { content: ""; - background: conic-gradient( - #fda4af 0% 25%, - #fb923c 75% 100% - ); + background: conic-gradient(#fda4af 0% 25%, #fb923c 75% 100%); position: absolute; top: 50%; left: 50%; From 444031103e8a246361684d88dda4e113725fd948 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 24 Aug 2024 20:59:32 -0500 Subject: [PATCH 06/10] update homies (#92) --- src/app/projects.ts | 54 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/app/projects.ts b/src/app/projects.ts index 0f57e2d..729f314 100644 --- a/src/app/projects.ts +++ b/src/app/projects.ts @@ -5,15 +5,33 @@ export const PROJECTS: ProductPost[] = [ id: "1", hasAi: false, topics: [ + { + name: "Discord", + description: "", + id: "1", + postId: "1", + }, + { + name: "Tauri", + description: "", + id: "1", + postId: "1", + }, { name: "React", description: "", id: "1", postId: "1", }, + { + name: "Rust", + description: "", + id: "1", + postId: "1", + }, ], deleted: false, - tagline: "The best way to find and share new music", + tagline: "Something about discord? idk", createdAt: new Date(), votesCount: 1337, thumbnailUrl: @@ -49,16 +67,28 @@ export const PROJECTS: ProductPost[] = [ hasAi: false, topics: [ { - name: "React", + name: "Seattle", + description: "", + id: "1", + postId: "1", + }, + { + name: "Food", + description: "", + id: "1", + postId: "1", + }, + { + name: "Svelte", description: "", id: "1", postId: "1", }, ], deleted: false, - tagline: "Get your food and not poo poo", + tagline: "See the health inspection results of Seattle restaurants", createdAt: new Date(), - votesCount: 1337, + votesCount: 42069, thumbnailUrl: "https://www.seattlesafeeats.com/_app/immutable/assets/needstoimprove.Cr0daC_v.png", name: "Seattle Safe Eats", @@ -70,6 +100,18 @@ export const PROJECTS: ProductPost[] = [ id: "1", hasAi: false, topics: [ + { + name: "Spotify", + description: "", + id: "1", + postId: "1", + }, + { + name: "Music", + description: "", + id: "1", + postId: "1", + }, { name: "React", description: "", @@ -78,9 +120,9 @@ export const PROJECTS: ProductPost[] = [ }, ], deleted: false, - tagline: "share your spotify", + tagline: "A clean and simple way to share your Spotify stats", createdAt: new Date(), - votesCount: 1337, + votesCount: 69420, thumbnailUrl: "https://splist.fm/android-chrome-192x192.png", name: "Splist.fm", url: "https://splist.fm/", From 8289ddca54a452c34e9301a61687fef4700276a2 Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Sat, 24 Aug 2024 21:08:07 -0500 Subject: [PATCH 07/10] Add GA --- package.json | 1 + pnpm-lock.yaml | 28 ++++++++++++++++++++++++---- src/app/layout.tsx | 4 ++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 87fcdcd..a7d6810 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "check:format": "prettier --check \"**/*.{ts,js,mjs}\"" }, "dependencies": { + "@next/third-parties": "^14.2.6", "@prisma/client": "5.18.0", "@vercel/analytics": "^1.3.1", "d3": "^7.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d0fc43..e38ecb4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@next/third-parties': + specifier: ^14.2.6 + version: 14.2.6(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) '@prisma/client': specifier: 5.18.0 version: 5.18.0(prisma@5.18.0) @@ -357,6 +360,12 @@ packages: cpu: [x64] os: [win32] + '@next/third-parties@14.2.6': + resolution: {integrity: sha512-gIayZnFgiir4HlyrqI/KS+MB4y82oVfSYYH4QwHa2KNOtCjX6etF8/cX3pSeSGsQi2VFiI+a9LL+MDMRYgIIoQ==} + peerDependencies: + next: ^13.0.0 || ^14.0.0 + react: ^18.2.0 + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2088,6 +2097,9 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + third-party-capital@1.0.20: + resolution: {integrity: sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA==} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -2374,6 +2386,12 @@ snapshots: '@next/swc-win32-x64-msvc@14.2.5': optional: true + '@next/third-parties@14.2.6(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)': + dependencies: + next: 14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + react: 18.3.1 + third-party-capital: 1.0.20 + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3342,7 +3360,7 @@ snapshots: eslint: 9.9.1(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@9.9.1(jiti@1.21.6)) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.1(jiti@1.21.6)) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@9.9.1(jiti@1.21.6)) eslint-plugin-jsx-a11y: 6.9.0(eslint@9.9.1(jiti@1.21.6)) eslint-plugin-react: 7.35.0(eslint@9.9.1(jiti@1.21.6)) eslint-plugin-react-hooks: 4.6.2(eslint@9.9.1(jiti@1.21.6)) @@ -3370,7 +3388,7 @@ snapshots: enhanced-resolve: 5.17.1 eslint: 9.9.1(jiti@1.21.6) eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@9.9.1(jiti@1.21.6)))(eslint@9.9.1(jiti@1.21.6)) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.1(jiti@1.21.6)) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@9.9.1(jiti@1.21.6)) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-core-module: 2.15.0 @@ -3392,7 +3410,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@9.9.1(jiti@1.21.6)): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@9.9.1(jiti@1.21.6)): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -3413,7 +3431,7 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4) + '@typescript-eslint/parser': 7.2.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -4380,6 +4398,8 @@ snapshots: dependencies: any-promise: 1.3.0 + third-party-capital@1.0.20: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 413838a..7abac53 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,4 +1,5 @@ import Image from "next/image"; +import { GoogleAnalytics } from "@next/third-parties/google"; import { Inter } from "next/font/google"; import "./globals.css"; @@ -35,7 +36,10 @@ export default function RootLayout({ {children} +