From bf5abd5b093e846cc6067c1568571abac8350650 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 25 Sep 2023 14:00:52 -0400 Subject: [PATCH] Adding a few more pages. --- joinlemmy-translations | 2 +- lemmy-translations | 2 +- package.json | 1 + ... 2022-11-02 - First release of LemmyBB.md} | 0 src/shared/components/common.tsx | 2 + src/shared/components/contact.tsx | 51 +++-- src/shared/components/main.tsx | 182 +----------------- src/shared/components/news-item.tsx | 8 +- src/shared/components/news.tsx | 98 ++++++++-- src/shared/components/symbols.tsx | 5 + tailwind.config.js | 2 +- yarn.lock | 28 +++ 12 files changed, 165 insertions(+), 216 deletions(-) rename src/assets/news/{2022-11-02- First release of LemmyBB.md => 2022-11-02 - First release of LemmyBB.md} (100%) create mode 100644 src/shared/components/common.tsx diff --git a/joinlemmy-translations b/joinlemmy-translations index ab6cef1..b5b5981 160000 --- a/joinlemmy-translations +++ b/joinlemmy-translations @@ -1 +1 @@ -Subproject commit ab6cef1e8445caac3d643fd1eb9917783f88c643 +Subproject commit b5b5981499854a7e25f128a5c8cc541b258e7e09 diff --git a/lemmy-translations b/lemmy-translations index 839f109..de9de2c 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 839f1097d07ba9d730e31f58c892de491442e490 +Subproject commit de9de2c53bee034d3824ecaa9a2104f8f341332e diff --git a/package.json b/package.json index d764d44..0d00831 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@babel/preset-env": "7.22.5", "@babel/preset-typescript": "^7.22.5", "@babel/runtime": "^7.22.5", + "@tailwindcss/typography": "^0.5.10", "@types/express": "^4.17.17", "@types/node": "^20.3.2", "@types/node-fetch": "^2.6.4", diff --git a/src/assets/news/2022-11-02- First release of LemmyBB.md b/src/assets/news/2022-11-02 - First release of LemmyBB.md similarity index 100% rename from src/assets/news/2022-11-02- First release of LemmyBB.md rename to src/assets/news/2022-11-02 - First release of LemmyBB.md diff --git a/src/shared/components/common.tsx b/src/shared/components/common.tsx new file mode 100644 index 0000000..09e7104 --- /dev/null +++ b/src/shared/components/common.tsx @@ -0,0 +1,2 @@ +export const gradientTextClasses = + "bg-gradient-to-r bg-clip-text text-transparent from-[#69D066] to-[#03A80E]"; diff --git a/src/shared/components/contact.tsx b/src/shared/components/contact.tsx index 6fb72ea..c89582f 100644 --- a/src/shared/components/contact.tsx +++ b/src/shared/components/contact.tsx @@ -1,6 +1,39 @@ import { Component } from "inferno"; import { Helmet } from "inferno-helmet"; import { i18n } from "../i18next"; +import { gradientTextClasses } from "./common"; +import { Icon } from "./icon"; + +const TitleBlock = () => ( +
+ {i18n.t("contact")} +
+); + +const ContactBlock = () => ( +
+
+
+ + + +
+
+
+); + +const ContactBtn = ({ title, url }) => ( + + + {title} + +); export class Contact extends Component { constructor(props: any, context: any) { @@ -9,24 +42,12 @@ export class Contact extends Component { render() { const title = i18n.t("contact_title"); return ( -
+
-
-

{i18n.t("contact")}

- -
+ +
); } diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index b366c6e..964ce7f 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -5,9 +5,7 @@ import { i18n } from "../i18next"; import { T } from "inferno-i18next"; import { isBrowser } from "../utils"; import { Icon } from "./icon"; - -const gradientTextClasses = - "bg-gradient-to-r bg-clip-text text-transparent from-[#69D066] to-[#03A80E]"; +import { gradientTextClasses } from "./common"; const LemmyTitleBlock = () => (
@@ -180,9 +178,7 @@ const DiscussionPlatformBlock = () => ( // TODO add all of these ones const MoreFeaturesBlock = () => (
-
+
{i18n.t("more_features")}
@@ -420,7 +416,7 @@ export class Main extends Component { return (
- {" "} + @@ -428,178 +424,6 @@ export class Main extends Component { - -
-
- -
-
-
-
-
- -
-
-

{i18n.t("open_source")}

-

- - ## - # - - # - - -

-
-
-
-
-
- -
-
-

{i18n.t("blazing_fast")}

-

- - ## - # - # - # - # - -

-
-
-
-
-
- -
-
-

{i18n.t("mod_tools")}

-

{i18n.t("mod_tools_desc")}

-
-
-
-
- -
-
- -
-
-

{i18n.t("create_discussion_platform")}

-

- - ## - # - # - -

-
-
-
-
-
-
-
-
-

{i18n.t("live_updates")}

-

{i18n.t("live_updates_desc")}

-
-
- -
-
-
-
-
-
-
-
- -
-
-

{i18n.t("more_features")}

-
    -
  • - - ## - # - -
  • -
  • {i18n.t("clean_interface")}
  • -
  • - - {i18n.t("mobile_apps_for_ios_and_android")} - -
  • -
  • {i18n.t("avatar_support")}
  • -
  • - - ### - -
  • -
  • {i18n.t("themes_including")}
  • -
  • - - ## - -
  • -
  • - - ## - # - -
  • -
  • {i18n.t("integrated_image_uploading")}
  • -
  • {i18n.t("notifications_including")}
  • -
  • - - # - - # - - -
  • -
  • - - ## - # - # - # - # - -
  • -
  • {i18n.t("can_fully_erase")}
  • -
  • {i18n.t("nsfw_support")}
  • -
-
-
-
-
-
-
-
-
-

- {i18n.t("support_donate")} -

-
-
-
-
); } diff --git a/src/shared/components/news-item.tsx b/src/shared/components/news-item.tsx index 2cb0c68..e124312 100644 --- a/src/shared/components/news-item.tsx +++ b/src/shared/components/news-item.tsx @@ -25,12 +25,14 @@ export class NewsItem extends Component { render() { return ( -
+
-
-
+
+
+
+
); diff --git a/src/shared/components/news.tsx b/src/shared/components/news.tsx index 7139da2..032f647 100644 --- a/src/shared/components/news.tsx +++ b/src/shared/components/news.tsx @@ -4,9 +4,87 @@ import { Helmet } from "inferno-helmet"; import { i18n } from "../i18next"; import { isBrowser } from "../utils"; import { news_md } from "../translations/news"; +import { gradientTextClasses } from "./common"; const title = i18n.t("news"); -const newsReversed = news_md.reverse(); +const authors = ["nutomic", "dessalines"]; +const news_reversed = news_md.reverse(); + +interface NewsInfo { + title: string; + dateStr: string; + preview: string; + authors: Array; + url: string; +} + +function buildNewsInfoArray(): Array { + return news_reversed.map(n => { + let split = n.title.split(" - "); + + return { + dateStr: split[0], + title: split[1], + preview: split[2] || previewMarkdown(n.markdown), + authors, + url: `news/${titleToUrl(n.title)}`, + }; + }); +} + +function titleToUrl(title: string): string { + return title.replace(/ /g, "_"); +} + +function previewMarkdown(markdown: string): string { + return markdown.replace(/#/g, "").slice(0, 100).concat("..."); +} + +const TitleBlock = () => ( +
{title}
+); + +const NewsCards = () => + buildNewsInfoArray().map(n => ( + + )); + +const NewsCard = ({ dateStr, authors, title, url, preview }: NewsInfo) => ( +
+
+
+
+
+ + {title} + +
{dateStr}
+ {authors.map(name => ( + + ))} +
+
{preview}
+
+ + {i18n.t("read_more")} + +
+
+
+); + +const AuthorBadge = ({ name }) => ( +
+ @ + {name} +
+); export class News extends Component { constructor(props: any, context: any) { @@ -21,25 +99,13 @@ export class News extends Component { render() { return ( -
+
-
-

{title}

-
    - {newsReversed.map(v => ( -
  • - {v.title} -
  • - ))} -
-
+ +
); } } - -function titleToUrl(title: string): string { - return title.replace(/ /g, "_"); -} diff --git a/src/shared/components/symbols.tsx b/src/shared/components/symbols.tsx index 73e0686..7049df8 100644 --- a/src/shared/components/symbols.tsx +++ b/src/shared/components/symbols.tsx @@ -20,6 +20,11 @@ export class Symbols extends Component { xmlnsXlink="http://www.w3.org/1999/xlink" > + + + + + diff --git a/tailwind.config.js b/tailwind.config.js index 6941691..25ae640 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,5 +16,5 @@ module.exports = { theme: { extend: {}, }, - plugins: [require("daisyui")], + plugins: [require("@tailwindcss/typography"), require("daisyui")], }; diff --git a/yarn.lock b/yarn.lock index dad10db..f9e949c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1220,6 +1220,16 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@tailwindcss/typography@^0.5.10": + version "0.5.10" + resolved "https://registry.yarnpkg.com/@tailwindcss/typography/-/typography-0.5.10.tgz#2abde4c6d5c797ab49cf47610830a301de4c1e0a" + integrity sha512-Pe8BuPJQJd3FfRnm6H0ulKIGoMEQS+Vq01R6M5aCrFB/ccR/shT+0kXLjouGC1gFLm9hopTFN+DMP0pfwRWzPw== + dependencies: + lodash.castarray "^4.4.0" + lodash.isplainobject "^4.0.6" + lodash.merge "^4.6.2" + postcss-selector-parser "6.0.10" + "@types/body-parser@*": version "1.19.2" resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" @@ -5007,6 +5017,11 @@ lodash._root@~3.0.0: resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" integrity sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI= +lodash.castarray@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.castarray/-/lodash.castarray-4.4.0.tgz#c02513515e309daddd4c24c60cfddcf5976d9115" + integrity sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q== + lodash.clonedeep@~4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -5017,6 +5032,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" @@ -6363,6 +6383,14 @@ postcss-nested@^6.0.1: dependencies: postcss-selector-parser "^6.0.11" +postcss-selector-parser@6.0.10: + version "6.0.10" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz#79b61e2c0d1bfc2602d549e11d0876256f8df88d" + integrity sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + postcss-selector-parser@^6.0.11: version "6.0.13" resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz#d05d8d76b1e8e173257ef9d60b706a8e5e99bf1b"