Skip to content

Commit 6ca84d3

Browse files
committed
new(log): Relay 2024
1 parent 436f99e commit 6ca84d3

File tree

5 files changed

+71
-6
lines changed

5 files changed

+71
-6
lines changed

public/data/logs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
[
2+
{
3+
"title": "Relay",
4+
"category": "Movie",
5+
"director": "David Mackenzie",
6+
"date": "2025-10-16",
7+
"rating": 4,
8+
"link": "https://www.imdb.com/title/tt11539996/",
9+
"slug": "relay-2024"
10+
},
211
{
312
"title": "The Hitchhiker's Guide to the Galaxy",
413
"category": "Book",

public/logs/relay-2024.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Relay
2+
3+
- **Category:** Movie
4+
- **Director:** David Mackenzie
5+
- **Release Date:** 2025-08-22
6+
- **Rating:** 4/5
7+
- **Link:** [IMDb](https://www.imdb.com/title/tt11539996/)
8+
9+
A broker who facilitates lucrative payoffs between corrupt corporations and individuals threatening them,
10+
breaks his own rules when a new client seeks his protection to stay alive.
11+
12+
## My Notes
13+
14+
I watched Relay. I liked [Lily James](https://www.imdb.com/name/nm4141252/)'s character.
15+
The plot twist was handled well. The New York vibe in the movie was fantastic.
16+
It's a vibe movie. The music was awesome. Cinematographically, it has one of the best uses of color palettes.
17+
[Riz Ahmed](https://www.imdb.com/name/nm1981893) as always is **meh**. I really don't know if he is the most terrible or the greatest
18+
actor of all time. It is hard to hate him or love him. Great movie nonetheless.

public/posts/do-i-need-to-create-a-lib-for-that.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This library aims to simplify the process of setting up and managing tournaments
2121

2222
## Ok, but why?
2323

24-
The inspiration for `go-tournament-brackets` struck during a casual phone call with a friend. I was unwinding, listening to [Morcheeba's "Easier Said than Done,"](https://www.youtube.com/watch?v=27lPAUdE1ys)
24+
The inspiration for `go-tournament-brackets` struck during a casual phone call with a friend, Mustafa, (_he personally requested to be named directly_). I was unwinding, listening to [Morcheeba's "Easier Said than Done,"](https://www.youtube.com/watch?v=27lPAUdE1ys)
2525
when he posed a fun challenge: rank our favorite rappers. His idea was to create a bracket, share it, and play through it together. Simple enough, right?
2626

2727
Not quite. As he started looking for online bracket makers, we quickly hit a wall. Most platforms demanded sign-ups,

src/components/ColorLegends.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
const categoryStyles = {
3+
export const categoryStyles = {
44
Book: {
55
backgroundColor: 'rgba(59, 130, 246, 0.1)',
66
borderColor: 'rgba(59, 130, 246, 0.5)',

src/pages/LogsPage.js

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import { Link } from 'react-router-dom';
33
import { ArrowLeftIcon, CaretDown, CaretUp } from '@phosphor-icons/react';
44
import LogCard from '../components/LogCard';
5-
import ColorLegends from '../components/ColorLegends';
5+
import ColorLegends, { categoryStyles } from '../components/ColorLegends';
66
import usePageTitle from "../utils/usePageTitle";
77

88
const LogsPage = () => {
@@ -11,14 +11,33 @@ const LogsPage = () => {
1111
const [showLegends, setShowLegends] = useState(false);
1212
const [loading, setLoading] = useState(true);
1313
const [hiddenLegends, setHiddenLegends] = useState([]);
14+
const [allCategoriesSelected, setAllCategoriesSelected] = useState(true);
15+
16+
const handleToggleAllCategories = () => {
17+
if (allCategoriesSelected) {
18+
setHiddenLegends(Object.keys(categoryStyles));
19+
} else {
20+
setHiddenLegends([]);
21+
}
22+
setAllCategoriesSelected(!allCategoriesSelected);
23+
};
1424

1525
const handleLegendClick = (legend) => {
1626
setHiddenLegends((prevHiddenLegends) => {
17-
if (prevHiddenLegends.includes(legend)) {
18-
return prevHiddenLegends.filter((item) => item !== legend);
27+
const newHiddenLegends = prevHiddenLegends.includes(legend)
28+
? prevHiddenLegends.filter((item) => item !== legend)
29+
: [...prevHiddenLegends, legend];
30+
31+
// Update allCategoriesSelected based on the new state of hiddenLegends
32+
if (newHiddenLegends.length === 0) {
33+
setAllCategoriesSelected(true);
34+
} else if (newHiddenLegends.length === Object.keys(categoryStyles).length) {
35+
setAllCategoriesSelected(false);
1936
} else {
20-
return [...prevHiddenLegends, legend];
37+
// If some are selected and some are not, it's neither all selected nor all deselected
38+
setAllCategoriesSelected(false);
2139
}
40+
return newHiddenLegends;
2241
});
2342
};
2443

@@ -99,6 +118,25 @@ const LogsPage = () => {
99118
onLegendClick={handleLegendClick}
100119
hiddenLegends={hiddenLegends}
101120
/>
121+
<div className="flex items-center justify-center mt-4">
122+
<span className="mr-2 text-white text-sm">Disable All</span>
123+
<label htmlFor="toggle-all-categories" className="flex items-center cursor-pointer">
124+
<div className="relative">
125+
<input
126+
type="checkbox"
127+
id="toggle-all-categories"
128+
className="sr-only"
129+
checked={allCategoriesSelected}
130+
onChange={handleToggleAllCategories}
131+
/>
132+
<div className={`block w-10 h-6 rounded-full ${allCategoriesSelected ? 'bg-blue-500' : 'bg-gray-600'}`}></div>
133+
<div
134+
className={`dot absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition ${allCategoriesSelected ? 'translate-x-4 bg-primary-500' : ''}`}
135+
></div>
136+
</div>
137+
</label>
138+
<span className="ml-2 text-white text-sm">Enable All</span>
139+
</div>
102140
</div>
103141
)}
104142
<div className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 ${!showLegends ? 'mt-8' : ''}`}>

0 commit comments

Comments
 (0)