-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from alleslabs/public-proj
Public project page
- Loading branch information
Showing
32 changed files
with
1,293 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { Box, SimpleGrid, Flex, Button, Icon } from "@chakra-ui/react"; | ||
import { matchSorter } from "match-sorter"; | ||
import { useMemo, useState } from "react"; | ||
import { BsGithub } from "react-icons/bs"; | ||
import { MdOutlineManageSearch, MdSearchOff } from "react-icons/md"; | ||
|
||
import { TextInput } from "lib/components/forms"; | ||
import { EmptyState } from "lib/components/state/EmptyState"; | ||
import { usePublicProjectStore } from "lib/hooks"; | ||
import { usePublicProjectsQuery } from "lib/services/publicProject"; | ||
|
||
import { PublicProjectCard } from "./PublicProjectCard"; | ||
|
||
export const AllProject = () => { | ||
const { data: publicProjectInfo } = usePublicProjectsQuery(); | ||
const [searchKeyword, setSearchKeyword] = useState(""); | ||
const { getSavedPublicProjects } = usePublicProjectStore(); | ||
|
||
const filteredPublicProjects = useMemo(() => { | ||
if (publicProjectInfo) { | ||
const savedProjects = getSavedPublicProjects(); | ||
// HACKED | ||
// TODO Sort saved project | ||
const orderedProjects = publicProjectInfo.map((project) => { | ||
const foundIndex = savedProjects.findIndex( | ||
(each) => each.slug === project.slug | ||
); | ||
|
||
return { | ||
...project, | ||
order: foundIndex === -1 ? 9999 : foundIndex, | ||
}; | ||
}); | ||
|
||
return matchSorter(orderedProjects, searchKeyword, { | ||
keys: ["details.name"], | ||
}); | ||
} | ||
return []; | ||
}, [getSavedPublicProjects, publicProjectInfo, searchKeyword]); | ||
|
||
if (!publicProjectInfo) | ||
return ( | ||
<Flex flexDirection="column" alignItems="center"> | ||
<EmptyState | ||
icon={MdOutlineManageSearch} | ||
message="We are currently gathering public projects to feature here. If you would like to share your project with the community, please submit your request." | ||
/> | ||
<Button gap={2} mt={8}> | ||
<Icon as={BsGithub} /> | ||
Submit on Github | ||
</Button> | ||
</Flex> | ||
); | ||
|
||
return ( | ||
<Box minH="xs" w="100%"> | ||
<TextInput | ||
variant="floating" | ||
value={searchKeyword} | ||
setInputState={setSearchKeyword} | ||
label="Search for existing public projects" | ||
size="md" | ||
mb={12} | ||
/> | ||
{!filteredPublicProjects.length ? ( | ||
<EmptyState | ||
message="None of your lists matches this search." | ||
icon={MdSearchOff} | ||
/> | ||
) : ( | ||
<SimpleGrid columns={{ sm: 1, md: 3, xl: 4 }} spacing={4} w="full"> | ||
{filteredPublicProjects.map((item) => ( | ||
<PublicProjectCard | ||
key={item.slug} | ||
item={item.details} | ||
slug={item.slug} | ||
/> | ||
))} | ||
</SimpleGrid> | ||
)} | ||
</Box> | ||
); | ||
}; |
Oops, something went wrong.
beec0d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
osmosis-celatone-frontend-staging – ./
osmosis-celatone-frontend-staging-alles-labs.vercel.app
celatone-frontend-staging.vercel.app
osmosis-celatone-frontend-staging-git-develop-alles-labs.vercel.app
osmosis-staging.celat.one
beec0d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
terra-celatone-frontend-staging – ./
terra-celatone-frontend-staging.vercel.app
terra-celatone-frontend-staging-git-develop-alles-labs.vercel.app
terra-staging.celat.one
terra-celatone-frontend-staging-alles-labs.vercel.app