-
Notifications
You must be signed in to change notification settings - Fork 2
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 #536 from us3r-network/u3-dev
release U3 giveaway
- Loading branch information
Showing
38 changed files
with
2,117 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import { UserAvatar, UserName } from '@us3r-network/profile'; | ||
import useLogin from '../../hooks/shared/useLogin'; | ||
|
||
export default function LoginButtonV2() { | ||
const { isLogin, login } = useLogin(); | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<button | ||
type="button" | ||
className="flex items-center gap-[8px] rounded-[12px] text-white text-[16px] font-bold" | ||
onClick={() => { | ||
if (isLogin) { | ||
navigate('/u'); | ||
} else { | ||
login(); | ||
} | ||
}} | ||
> | ||
{isLogin ? ( | ||
<> | ||
<UserAvatar | ||
className="w-[40px] h-[40px] flex-shrink-0" | ||
style={{ width: '40px', height: '40px' }} | ||
/> | ||
<UserName className="text-[#FFF] text-[16px] font-normal" /> | ||
</> | ||
) : ( | ||
<span className="wl-user-button_no-login-text">Login</span> | ||
)} | ||
</button> | ||
); | ||
} |
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
133 changes: 133 additions & 0 deletions
133
apps/u3/src/components/news/links/community/CommunityLinks.tsx
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,133 @@ | ||
/* | ||
* @Author: shixuewen [email protected] | ||
* @Date: 2022-07-05 15:35:42 | ||
* @LastEditors: bufan [email protected] | ||
* @LastEditTime: 2023-12-06 10:36:45 | ||
* @Description: 首页任务看板 | ||
*/ | ||
import styled from 'styled-components'; | ||
// import { useNavigate } from 'react-router-dom'; | ||
import InfiniteScroll from 'react-infinite-scroll-component'; | ||
import Loading from '../../../common/loading/Loading'; | ||
import ListScrollBox from '../../../common/box/ListScrollBox'; | ||
import { MainWrapper } from '../../../layout/Index'; | ||
import NoResult from '../../../layout/NoResult'; | ||
import { LinksPageProps } from '../LinksPage'; | ||
import LinksList from './LinksList'; | ||
|
||
export default function CommunityLinks({ | ||
loading, | ||
hasMore, | ||
links, | ||
// currentSearchParams, | ||
// searchParamsChange, | ||
getMore, | ||
quickView, | ||
}: LinksPageProps) { | ||
// const navigate = useNavigate(); | ||
|
||
return ( | ||
<Box> | ||
{(() => { | ||
if (loading) { | ||
return ( | ||
<LinksWrapper> | ||
<div className="loading"> | ||
<Loading /> | ||
</div> | ||
</LinksWrapper> | ||
); | ||
} | ||
if (links.length === 0) { | ||
return ( | ||
<LinksWrapper> | ||
<NoResult /> | ||
</LinksWrapper> | ||
); | ||
} | ||
|
||
return ( | ||
<ListBox id="links-scroll-wrapper"> | ||
<InfiniteScroll | ||
style={{ overflow: 'hidden' }} | ||
dataLength={links?.length || 0} | ||
next={() => { | ||
if (loading) return; | ||
getMore(); | ||
}} | ||
hasMore={hasMore} | ||
scrollThreshold="600px" | ||
loader={ | ||
<LoadingMoreWrapper> | ||
<Loading /> | ||
</LoadingMoreWrapper> | ||
} | ||
scrollableTarget="links-scroll-wrapper" | ||
> | ||
<LinksList | ||
data={links} | ||
onItemClick={(item) => { | ||
// navigate(item?.url); | ||
if (quickView) { | ||
quickView(item); | ||
return; | ||
} | ||
window.open(item?.url, '_blank'); | ||
}} | ||
/> | ||
</InfiniteScroll> | ||
</ListBox> | ||
); | ||
})()} | ||
</Box> | ||
); | ||
} | ||
|
||
const Box = styled(MainWrapper)` | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 24px; | ||
`; | ||
const LinksWrapper = styled.div` | ||
border-radius: 20px; | ||
overflow: hidden; | ||
display: flex; | ||
flex-grow: 1; | ||
& .loading { | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100%; | ||
} | ||
`; | ||
const ListBox = styled(ListScrollBox)` | ||
width: 100%; | ||
height: calc(100%); | ||
overflow: scroll; | ||
& .load-more { | ||
margin: 20px; | ||
text-align: center; | ||
color: #718096; | ||
> button { | ||
cursor: pointer; | ||
background-color: inherit; | ||
color: #fff; | ||
border: 1px solid gray; | ||
border-radius: 5px; | ||
padding: 10px 20px; | ||
outline: none; | ||
} | ||
} | ||
`; | ||
|
||
const LoadingMoreWrapper = styled.div` | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top: 20px; | ||
`; |
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,41 @@ | ||
/* | ||
* @Author: shixuewen [email protected] | ||
* @Date: 2022-12-08 14:04:04 | ||
* @LastEditors: bufan [email protected] | ||
* @LastEditTime: 2023-11-14 17:42:47 | ||
* @Description: file description | ||
*/ | ||
import styled from 'styled-components'; | ||
import { LinkListItem } from 'src/services/news/types/links'; | ||
import AnimatedListItem, { | ||
useAnimatedListTransition, | ||
} from '../../../common/animation/AnimatedListItem'; | ||
import ListItem from './LinksListItem'; | ||
|
||
export type LinksListProps = { | ||
data: LinkListItem[]; | ||
onItemClick?: (item: LinkListItem) => void; | ||
}; | ||
export default function LinksList({ data, onItemClick }: LinksListProps) { | ||
const transitions = useAnimatedListTransition(data); | ||
return ( | ||
<Wrapper> | ||
{transitions((styles, item) => { | ||
return ( | ||
<AnimatedListItem key={item.url} styles={{ ...styles }}> | ||
<ListItem | ||
data={item} | ||
onClick={() => onItemClick && onItemClick(item)} | ||
/> | ||
</AnimatedListItem> | ||
); | ||
})} | ||
</Wrapper> | ||
); | ||
} | ||
const Wrapper = styled.div` | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 20px; | ||
`; |
Oops, something went wrong.