Skip to content

Commit d2e334e

Browse files
authored
feat(socials): add project public view for socials (#1032)
1 parent 79c4180 commit d2e334e

File tree

8 files changed

+403
-42
lines changed

8 files changed

+403
-42
lines changed

src/Router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import HealthCheck from "./components/HealthCheck";
1010
import ClustersPage from "./pages/admin/ClustersPage";
1111
import ClusterSettingsPage from "./pages/admin/cluster/ClusterSettingsPage";
1212
import ProfileViewPage from "./pages/Users/ProfileViewPage";
13+
import ProjectViewPage from "./pages/Projects/ProjectViewPage";
1314

1415
// import { HomePage } from "./pages/Home.page";
1516
const AppsListPage = React.lazy(() => import("./pages/Apps/AppsListPage"));
@@ -82,6 +83,7 @@ export const DashboardRoutes = [
8283
{ path: "/", element: <LandingPage /> },
8384
{ path: "/explore", element: <ExplorePage /> },
8485
{ path: "/tags/:tagName", element: <TagDetailsPage /> },
86+
{ path: "/explore/:project_id", element: <ProjectViewPage /> },
8587
{ path: "/profile/:user_id", element: <UserProfilePage /> },
8688
{ path: "/users/profile/settings", element: <UserProfileSettingsPage /> },
8789
{ path: "/:username", element: <ProfileViewPage /> },

src/components/Cards/ProjectExploreCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const ProjectExploreCard = ({ project }: ProjectExploreCardProps) => {
8686
radius="lg"
8787
style={{
8888
flex: "1 1 350px",
89-
maxWidth: "380px",
9089
display: "flex",
9190
flexDirection: "column",
9291
}}
@@ -97,7 +96,7 @@ const ProjectExploreCard = ({ project }: ProjectExploreCardProps) => {
9796
<div>
9897
<Anchor
9998
component={Link}
100-
to={project.link || "#"}
99+
to={`/explore/${project?.id}`}
101100
fw={600}
102101
style={{ textDecoration: "none" }}
103102
>

src/components/Cards/ProjectSocialsCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ export default function ProjectSocialsCard({
360360
bottom: "15px",
361361
right: "8px",
362362
}}
363+
tt="capitalize"
363364
>
364365
{isPublicProject ? "Public" : "Private"}
365366
</Badge>

src/components/Header.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { Logo, UserDropDown } from "./Common";
3535
import { Link, useNavigate } from "react-router-dom";
3636
import Search from "./Elements/Search";
3737
import { useAuth } from "@/utils/AuthContext";
38-
import { IoAirplaneOutline } from "react-icons/io5";
38+
import { DOCS_URL } from "@/config";
3939

4040
interface HeaderProps {
4141
opened: boolean;
@@ -71,12 +71,18 @@ export const DashboardHeader = ({ opened, toggle }: HeaderProps) => {
7171
>
7272
<Group gap={5}>
7373
<Text fw={700}>Explore</Text>
74-
<IoAirplaneOutline
75-
size={18}
76-
style={{ transform: "rotate(315deg)" }}
77-
/>
7874
</Group>
7975
</Link>
76+
<a
77+
href={`${DOCS_URL}`}
78+
target="_blank"
79+
rel="noopener noreferrer"
80+
style={{ textDecoration: "none", paddingLeft: "10px" }}
81+
>
82+
<Group gap={5}>
83+
<Text fw={700}>Docs</Text>
84+
</Group>
85+
</a>
8086
</Group>
8187
<Group>
8288
<Search />

src/components/Trending/TrendingProjects.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function TrendingProjects({
5959
<Group align="flex-start" gap={12} mt={2}>
6060
<div style={{ flex: 1 }}>
6161
<Anchor
62-
href={`/projects/${project.id}`}
62+
href={`/explore/${project.id}`}
6363
size="sm"
6464
fw={500}
6565
style={{
@@ -110,7 +110,7 @@ export default function TrendingProjects({
110110

111111
<Group gap={2} mt={6}>
112112
<FiUsers size={10} color="#6c757d" />
113-
<Text size="xs" c="dimmed" fw={500} ml={2}>
113+
<Text size="sm" c="dimmed" fw={500} ml={2}>
114114
{project.followers_count || 0} followers
115115
</Text>
116116
</Group>

src/pages/ExplorePage.tsx

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
Select,
1313
SimpleGrid,
1414
ThemeIcon,
15-
Flex,
1615
Center,
1716
Box,
1817
Loader,
@@ -282,37 +281,29 @@ const ExplorePage = () => {
282281
</Tabs.Panel>
283282

284283
<Tabs.Panel value="projects">
285-
<Grid>
286-
<Grid.Col span={12}>
287-
<Flex wrap="wrap" gap="lg" justify="flex-start">
288-
{searching ? (
289-
<Center w="100%" h="300px">
290-
<Loader size="xl" type="oval" />
291-
</Center>
292-
) : selectedCategory === "projects" ? (
293-
searchQuery !== "" ? (
294-
searchResponse?.data?.projects?.length > 0 ? (
295-
searchResponse.data.projects.map((project: any) => (
296-
<ProjectExploreCard
297-
key={project.id}
298-
project={project}
299-
/>
300-
))
301-
) : (
302-
<EmptyState message="No projects found" />
303-
)
304-
) : (
305-
projectsResponse?.data?.projects?.map((project: any) => (
306-
<ProjectExploreCard
307-
key={project.id}
308-
project={project}
309-
/>
310-
))
311-
)
312-
) : null}
313-
</Flex>
314-
</Grid.Col>
315-
</Grid>
284+
<SimpleGrid cols={{ base: 1, sm: 2, md: 3 }} spacing="md">
285+
{searching ? (
286+
<div style={{ gridColumn: "1 / -1" }}>
287+
<Center w="100%" h="300px">
288+
<Loader size="xl" type="oval" />
289+
</Center>
290+
</div>
291+
) : selectedCategory === "projects" ? (
292+
searchQuery !== "" ? (
293+
searchResponse?.data?.projects?.length > 0 ? (
294+
searchResponse.data.projects.map((project: any) => (
295+
<ProjectExploreCard key={project.id} project={project} />
296+
))
297+
) : (
298+
<EmptyState message="No projects found" />
299+
)
300+
) : (
301+
projectsResponse?.data?.projects?.map((project: any) => (
302+
<ProjectExploreCard key={project.id} project={project} />
303+
))
304+
)
305+
) : null}
306+
</SimpleGrid>
316307
</Tabs.Panel>
317308

318309
<Tabs.Panel value="users">
@@ -545,7 +536,7 @@ interface EmptyStateProps {
545536
message?: string;
546537
}
547538

548-
const EmptyState = ({ message = "No data found" }: EmptyStateProps) => {
539+
export const EmptyState = ({ message = "No data found" }: EmptyStateProps) => {
549540
return (
550541
<Center w="100%" h="200px">
551542
<Box

0 commit comments

Comments
 (0)