From 6d85d79f2d0ba58212b8766131c9bde7299ef818 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Mon, 23 Dec 2024 16:25:25 +0200
Subject: [PATCH 01/11] fix(topic admin): add necessary import statement
---
django_topics/admin.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/django_topics/admin.py b/django_topics/admin.py
index 6b5106d26e..631a153a4d 100644
--- a/django_topics/admin.py
+++ b/django_topics/admin.py
@@ -1,6 +1,8 @@
from django.contrib import admin, messages
from django_topics.models import Topic, TopicPool, FeaturedTopicEnglish, FeaturedTopicHebrew, SeasonalTopicEnglish, SeasonalTopicHebrew
from django_topics.models.pool import PoolType
+from django.utils.html import format_html
+
def create_add_to_pool_action(pool_name):
From 425266f66c1ac7276a681498f2f1fe07b0ec2dfc Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Mon, 23 Dec 2024 16:26:07 +0200
Subject: [PATCH 02/11] feat(topic landing page): skeleton of the TopicMonte
component
---
.../js/TopicLandingPage/TopicsLandingPage.jsx | 4 +-
static/js/TopicLandingPage/TopicsMonte.jsx | 51 +++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 static/js/TopicLandingPage/TopicsMonte.jsx
diff --git a/static/js/TopicLandingPage/TopicsLandingPage.jsx b/static/js/TopicLandingPage/TopicsLandingPage.jsx
index 8d5ccd905e..76fb22eeea 100644
--- a/static/js/TopicLandingPage/TopicsLandingPage.jsx
+++ b/static/js/TopicLandingPage/TopicsLandingPage.jsx
@@ -9,6 +9,7 @@ import {TopicLandingCalendar} from "./TopicLandingCalendar";
import {TopicLandingParasha} from "./TopicLandingParasha";
import {TopicLandingSeasonal} from "./TopicLandingSeasonal";
import Sefaria from "../sefaria/sefaria";
+import {TopicsMonte} from "./TopicsMonte";
export const TopicsLandingPage = ({openTopic}) => {
@@ -27,7 +28,8 @@ export const TopicsLandingPage = ({openTopic}) => {
-
+
+
diff --git a/static/js/TopicLandingPage/TopicsMonte.jsx b/static/js/TopicLandingPage/TopicsMonte.jsx
new file mode 100644
index 0000000000..11dd72ccdb
--- /dev/null
+++ b/static/js/TopicLandingPage/TopicsMonte.jsx
@@ -0,0 +1,51 @@
+import React from 'react';
+import {useEffect, useState} from "react";
+import Sefaria from "../sefaria/sefaria";
+import {InterfaceText} from "../Misc";
+
+
+export const TopicsMonte = () => {
+ const numTopics = 3;
+ const [deck, setDeck] = useState([]);
+
+ const renderSaladItem = (item) => {
+ return(
+
+ )
+ }
+
+ const fetchRandomTopicDeck = async () => {
+ const poolName = Sefaria.getLangSpecificTopicPoolName('general');
+ const topics = await Sefaria.getTopicsByPool(poolName, numTopics*numTopics);
+ const lang = Sefaria.interfaceLang == "hebrew"? 'he' : 'en';
+ console.log(topics)
+ const deck = topics
+ .filter(topic => topic.description?.[lang])
+ .slice(0, numTopics)
+ .map(topic => ({
+ slug: topic.slug,
+ title: topic.primaryTitle,
+ description: topic.description
+ }));
+ console.log(deck);
+ return deck;
+ }
+
+ const loadDeck = async () => {
+ const deck = await fetchRandomTopicDeck();
+ setDeck(deck);
+ };
+
+ useEffect(() => {
+ loadDeck();
+ }, []);
+
+ return (
+ <>
+
+ {deck.map(topic=>
{topic.slug}
)}
+
+ >
+
+ );
+};
\ No newline at end of file
From 5b5d1fc402adf1b6d6045960054019836334f912 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Tue, 24 Dec 2024 15:24:26 +0200
Subject: [PATCH 03/11] feat(topic landing page): change name of component and
arranging proportion of boxes
---
static/css/s2.css | 27 +++++++++++++++++++
... => RandomTopicCardWithDescriptionRow.jsx} | 12 ++++++---
.../js/TopicLandingPage/TopicsLandingPage.jsx | 4 +--
3 files changed, 37 insertions(+), 6 deletions(-)
rename static/js/TopicLandingPage/{TopicsMonte.jsx => RandomTopicCardWithDescriptionRow.jsx} (77%)
diff --git a/static/css/s2.css b/static/css/s2.css
index d0e84cf785..8a90ae8350 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5153,6 +5153,33 @@ body .ui-autocomplete.dictionary-toc-autocomplete .ui-menu-item a.ui-state-focus
.topic-landing-parasha .navSidebarLink span{
font-family: Roboto, sans-serif;
}
+.topic-card-with-description-row{
+ display: flex;
+ margin-top: 30px;
+ gap: 20px;
+}
+.topic-card-with-description{
+ flex: 1;
+ border-top: 4px solid var(--Sefaria-Blue, #18345D);
+ background: var(--Lightest-Grey, #FBFBFA);
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
+ width: 268.395px;
+ height: 345.78px;
+}
+.topic-card-with-description .cardDescription{
+ margin-inline-end: 30px;
+ margin-inline-start: 30px;
+ width: 207.593px;
+ height: 140.617px;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ overflow-y: hidden;
+ overflow-x: visible;
+ word-wrap: break-word;
+}
+.topic-card-with-description .cardTitle {
+ margin-inline-start: 30px;
+}
.readerNavMenu .sheet {
display: flex;
justify-content: space-between;
diff --git a/static/js/TopicLandingPage/TopicsMonte.jsx b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
similarity index 77%
rename from static/js/TopicLandingPage/TopicsMonte.jsx
rename to static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
index 11dd72ccdb..56232da836 100644
--- a/static/js/TopicLandingPage/TopicsMonte.jsx
+++ b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
@@ -2,9 +2,10 @@ import React from 'react';
import {useEffect, useState} from "react";
import Sefaria from "../sefaria/sefaria";
import {InterfaceText} from "../Misc";
+import {Card} from "../common/Card";
-export const TopicsMonte = () => {
+export const RandomTopicCardWithDescriptionRow = () => {
const numTopics = 3;
const [deck, setDeck] = useState([]);
@@ -27,7 +28,6 @@ export const TopicsMonte = () => {
title: topic.primaryTitle,
description: topic.description
}));
- console.log(deck);
return deck;
}
@@ -42,8 +42,12 @@ export const TopicsMonte = () => {
return (
<>
-
- {deck.map(topic=>
{topic.slug}
)}
+
>
diff --git a/static/js/TopicLandingPage/TopicsLandingPage.jsx b/static/js/TopicLandingPage/TopicsLandingPage.jsx
index 76fb22eeea..af53e101b4 100644
--- a/static/js/TopicLandingPage/TopicsLandingPage.jsx
+++ b/static/js/TopicLandingPage/TopicsLandingPage.jsx
@@ -9,7 +9,7 @@ import {TopicLandingCalendar} from "./TopicLandingCalendar";
import {TopicLandingParasha} from "./TopicLandingParasha";
import {TopicLandingSeasonal} from "./TopicLandingSeasonal";
import Sefaria from "../sefaria/sefaria";
-import {TopicsMonte} from "./TopicsMonte";
+import {RandomTopicCardWithDescriptionRow} from "./RandomTopicCardWithDescriptionRow";
export const TopicsLandingPage = ({openTopic}) => {
@@ -28,7 +28,7 @@ export const TopicsLandingPage = ({openTopic}) => {
-
+
From 4a79cb9678aa3b6b6fa22a72ed6b27b32e5eebe5 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Thu, 9 Jan 2025 13:55:54 +0200
Subject: [PATCH 04/11] feat(topic landing random cards): add link at the
bottom of card
---
static/css/s2.css | 19 +++++++++++++----
.../RandomTopicCardWithDescriptionRow.jsx | 21 ++++++++++++-------
static/js/common/Card.jsx | 5 +++--
3 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index 8a90ae8350..3500c5f097 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5158,7 +5158,7 @@ body .ui-autocomplete.dictionary-toc-autocomplete .ui-menu-item a.ui-state-focus
margin-top: 30px;
gap: 20px;
}
-.topic-card-with-description{
+.topic-card-with-description .card{
flex: 1;
border-top: 4px solid var(--Sefaria-Blue, #18345D);
background: var(--Lightest-Grey, #FBFBFA);
@@ -5169,14 +5169,25 @@ body .ui-autocomplete.dictionary-toc-autocomplete .ui-menu-item a.ui-state-focus
.topic-card-with-description .cardDescription{
margin-inline-end: 30px;
margin-inline-start: 30px;
- width: 207.593px;
- height: 140.617px;
+ /*width: 207.593px;*/
+ /*height: 140.617px;*/
display: -webkit-box;
-webkit-box-orient: vertical;
overflow-y: hidden;
- overflow-x: visible;
+ /*overflow-x: visible;*/
word-wrap: break-word;
}
+.topic-card-with-description .explore-more-prompt {
+ font-size: 14px;
+ line-height: 18px;
+ color: #666;
+ margin-inline-end: 20px;
+ --english-font: var(--english-sans-serif-font-family);
+ --hebrew-font: var(--hebrew-sans-serif-font-family);
+ position: absolute;
+ bottom: 14px;
+ margin-inline-start: 10px;
+}
.topic-card-with-description .cardTitle {
margin-inline-start: 30px;
}
diff --git a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
index 56232da836..3f67cd1c9a 100644
--- a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
+++ b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
@@ -19,7 +19,6 @@ export const RandomTopicCardWithDescriptionRow = () => {
const poolName = Sefaria.getLangSpecificTopicPoolName('general');
const topics = await Sefaria.getTopicsByPool(poolName, numTopics*numTopics);
const lang = Sefaria.interfaceLang == "hebrew"? 'he' : 'en';
- console.log(topics)
const deck = topics
.filter(topic => topic.description?.[lang])
.slice(0, numTopics)
@@ -43,13 +42,21 @@ export const RandomTopicCardWithDescriptionRow = () => {
return (
<>
- {deck.map(topic=>
)}
+ {deck.map(topic=>
)}
>
- );
+ );
};
\ No newline at end of file
diff --git a/static/js/common/Card.jsx b/static/js/common/Card.jsx
index d4538ec5fa..1c78cf7fc4 100644
--- a/static/js/common/Card.jsx
+++ b/static/js/common/Card.jsx
@@ -1,13 +1,14 @@
import {InterfaceText} from "../Misc";
import React from "react";
-const Card = ({cardTitle, cardTitleHref, oncardTitleClick, cardText}) => {
+const Card = ({cardTitle, cardTitleHref, oncardTitleClick, cardText, children}) => {
return
}
From c497c66909b7f69f2d966444fc2d5435b17aac12 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Thu, 9 Jan 2025 14:51:49 +0200
Subject: [PATCH 05/11] feat(topic landing random cards): fetch more topics to
increase chances of hitting 3 with descriptions
---
.../js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
index 3f67cd1c9a..7342a3d8c9 100644
--- a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
+++ b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
@@ -17,7 +17,7 @@ export const RandomTopicCardWithDescriptionRow = () => {
const fetchRandomTopicDeck = async () => {
const poolName = Sefaria.getLangSpecificTopicPoolName('general');
- const topics = await Sefaria.getTopicsByPool(poolName, numTopics*numTopics);
+ const topics = await Sefaria.getTopicsByPool(poolName, Math.pow(numTopics, 3));
const lang = Sefaria.interfaceLang == "hebrew"? 'he' : 'en';
const deck = topics
.filter(topic => topic.description?.[lang])
From b5587239e8de87d0e70eb5cbf689e02b1b90afe8 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Thu, 9 Jan 2025 16:41:28 +0200
Subject: [PATCH 06/11] feat(topic landing random cards): fix style
---
static/css/s2.css | 10 +++++++---
.../RandomTopicCardWithDescriptionRow.jsx | 4 ++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index b1ed73935b..aef04978e4 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5234,7 +5234,8 @@ h1.topic-landing-header {
.topic-card-with-description .cardDescription{
margin-inline-end: 30px;
margin-inline-start: 30px;
- /*width: 207.593px;*/
+ margin-top: 27px;
+ width: 207.593px;
/*height: 140.617px;*/
display: -webkit-box;
-webkit-box-orient: vertical;
@@ -5242,6 +5243,9 @@ h1.topic-landing-header {
/*overflow-x: visible;*/
word-wrap: break-word;
}
+.topic-card-with-description .cardTitle {
+ margin-top: 40px;
+}
.topic-card-with-description .explore-more-prompt {
font-size: 14px;
line-height: 18px;
@@ -5250,8 +5254,8 @@ h1.topic-landing-header {
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
position: absolute;
- bottom: 14px;
- margin-inline-start: 10px;
+ bottom: 41px;
+ margin-inline-start: 30px;
}
.topic-card-with-description .cardTitle {
margin-inline-start: 30px;
diff --git a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
index 7342a3d8c9..af2b1fa04c 100644
--- a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
+++ b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
@@ -49,8 +49,8 @@ export const RandomTopicCardWithDescriptionRow = () => {
cardText={topic.description}>
From cfb13fe847571ad1762fc92515c53bbd25f89caf Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Sun, 12 Jan 2025 11:21:53 +0200
Subject: [PATCH 07/11] feat(topic landing random cards): fix style of cards
---
static/css/s2.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index aef04978e4..39b092a49c 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5234,7 +5234,7 @@ h1.topic-landing-header {
.topic-card-with-description .cardDescription{
margin-inline-end: 30px;
margin-inline-start: 30px;
- margin-top: 27px;
+ margin-top: 19px;
width: 207.593px;
/*height: 140.617px;*/
display: -webkit-box;
@@ -5244,7 +5244,7 @@ h1.topic-landing-header {
word-wrap: break-word;
}
.topic-card-with-description .cardTitle {
- margin-top: 40px;
+ margin-top: 23px;
}
.topic-card-with-description .explore-more-prompt {
font-size: 14px;
From fd2466ec53d2b6e1df10bc26b9723c9eb0eedf9e Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Mon, 13 Jan 2025 15:12:31 +0200
Subject: [PATCH 08/11] refactor(random topic cards): turn bottom links into
props of Card component
---
static/css/s2.css | 2 +-
.../RandomTopicCardWithDescriptionRow.jsx | 13 ++++---------
static/js/common/Card.jsx | 14 ++++++++++----
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index 39b092a49c..eea5aa9a5f 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5246,7 +5246,7 @@ h1.topic-landing-header {
.topic-card-with-description .cardTitle {
margin-top: 23px;
}
-.topic-card-with-description .explore-more-prompt {
+.topic-card-with-description .bottomCardLink {
font-size: 14px;
line-height: 18px;
color: #666;
diff --git a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
index af2b1fa04c..926055137b 100644
--- a/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
+++ b/static/js/TopicLandingPage/RandomTopicCardWithDescriptionRow.jsx
@@ -46,15 +46,10 @@ export const RandomTopicCardWithDescriptionRow = () => {
-
-
- )}
+ cardText={topic.description}
+ bottomLinkText = {{en: `Explore ${topic.title?.en} ›`, he:`${Sefaria._("Explore")} ${topic.title?.he} ›`}}
+ bottomLinkUrl = {`topics/${topic.slug}`}/>
+ )}
>
diff --git a/static/js/common/Card.jsx b/static/js/common/Card.jsx
index 1c78cf7fc4..f0a45565f9 100644
--- a/static/js/common/Card.jsx
+++ b/static/js/common/Card.jsx
@@ -1,6 +1,6 @@
import {InterfaceText} from "../Misc";
import React from "react";
-const Card = ({cardTitle, cardTitleHref, oncardTitleClick, cardText, children}) => {
+const Card = ({cardTitle, cardTitleHref, oncardTitleClick, cardText, bottomLinkText, bottomLinkUrl}) => {
return
-}
+ }
-export { Card }
+export {Card}
\ No newline at end of file
From 6ecdc2a4366beb8dc3461bc3fd44f0aefafeec07 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Thu, 16 Jan 2025 16:11:20 +0200
Subject: [PATCH 09/11] refactor(topic landing): use color vars properly
---
static/css/s2.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index eea5aa9a5f..be0dc55c8d 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5225,8 +5225,8 @@ h1.topic-landing-header {
}
.topic-card-with-description .card{
flex: 1;
- border-top: 4px solid var(--Sefaria-Blue, #18345D);
- background: var(--Lightest-Grey, #FBFBFA);
+ border-top: 4px solid var(--sefaria-blue);
+ background: var(--lightest-grey);
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
width: 268.395px;
height: 345.78px;
From 6d35f9d1082e3819862f6aa14fbce0c90d916150 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Thu, 16 Jan 2025 16:35:41 +0200
Subject: [PATCH 10/11] refactor(topic landing): remove comments from css
---
static/css/s2.css | 2 --
1 file changed, 2 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index be0dc55c8d..ad4e9bf207 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5236,11 +5236,9 @@ h1.topic-landing-header {
margin-inline-start: 30px;
margin-top: 19px;
width: 207.593px;
- /*height: 140.617px;*/
display: -webkit-box;
-webkit-box-orient: vertical;
overflow-y: hidden;
- /*overflow-x: visible;*/
word-wrap: break-word;
}
.topic-card-with-description .cardTitle {
From 1a9cb43eca8462bad0d969621d0c77c92fbf1744 Mon Sep 17 00:00:00 2001
From: yonadavGit <92536571+yonadavGit@users.noreply.github.com>
Date: Mon, 20 Jan 2025 13:11:28 +0200
Subject: [PATCH 11/11] fix(topic landing): round nums in css
---
static/css/s2.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/static/css/s2.css b/static/css/s2.css
index ad4e9bf207..39b949d1ae 100644
--- a/static/css/s2.css
+++ b/static/css/s2.css
@@ -5228,8 +5228,8 @@ h1.topic-landing-header {
border-top: 4px solid var(--sefaria-blue);
background: var(--lightest-grey);
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
- width: 268.395px;
- height: 345.78px;
+ width: 268px;
+ height: 345px;
}
.topic-card-with-description .cardDescription{
margin-inline-end: 30px;