Skip to content

Commit

Permalink
ecosystem highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed Aug 20, 2024
1 parent 8e43b08 commit 96fd5ac
Show file tree
Hide file tree
Showing 5 changed files with 477 additions and 63 deletions.
6 changes: 6 additions & 0 deletions src/constants/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const getBlogCategoryList = lang => [
label: LANGUAGE_MAP[lang].technical,
key: "Technical",
},
{
label: LANGUAGE_MAP[lang].ecosystem_highlights,
key: "Ecosystem highlights",
},
]

export const getBlogSortList = lang => [
Expand All @@ -42,6 +46,7 @@ export const LANGUAGE_MAP = {
announcement: "Announcement",
general: "General",
technical: "Technical",
ecosystem_highlights: "Ecosystem highlights",
sort: "Order by",
newest: "Newest",
oldest: "Oldest",
Expand All @@ -56,6 +61,7 @@ export const LANGUAGE_MAP = {
announcement: "Duyuru",
general: "Genel",
technical: "Teknik",
ecosystem_highlights: "Ekosistem vurguları",
sort: "Şuna göre sırala",
newest: "En yeni",
oldest: "En eski",
Expand Down
6 changes: 5 additions & 1 deletion src/pages/blog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { orderBy } from "lodash"
import { useEffect, useMemo, useState } from "react"
import { useLocation } from "react-router-dom"
import useStorage from "squirrel-gill"

import { Tune as TuneIcon } from "@mui/icons-material"
Expand Down Expand Up @@ -162,6 +163,7 @@ const BlogList = styled("ul")(({ theme }) => ({
}))

const Blog = () => {
const location = useLocation()
const { isDesktop } = useCheckViewport()
const [language] = useStorage(localStorage, BLOG_LANGUAGE, "en")
const BLOG_CATEGORY_LIST = useMemo(() => getBlogCategoryList(language), [language])
Expand All @@ -171,10 +173,12 @@ const Blog = () => {
const handleFilterOpen = () => setFilterOpen(true)
const handleFilterClose = () => setFilterOpen(false)

const { category } = location.state || "All"

const [blogs, setBlogs] = useState(blogSource)
const [queryForm, setQueryForm] = useState({
sort: "Newest",
category: "All",
category,
})

const blogsWithLang = useMemo(() => filterBlogsByLanguage(blogSource, language), [blogSource, language])
Expand Down
8 changes: 2 additions & 6 deletions src/pages/ecosystem/Highlights/HighlightList/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ const ReadButton = styled(Button)(({ theme }) => ({
},
}))

const BlogCard = ({ blog, small = false }) => {
const BlogCard = ({ blog }) => {
const navigate = useNavigate()
const handleClick = () => {
if (blog.externalLink) {
window.location.href = blog.externalLink
} else {
navigate("/blog/" + blog.id)
}
navigate("/blog/" + blog.slug)
}

return (
Expand Down
Loading

0 comments on commit 96fd5ac

Please sign in to comment.