Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creators Staking #155

Merged
merged 93 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
0cdf174
style: remove post count title in post page because of redundant data
teodorus-nathaniel Dec 19, 2023
70cfd16
feat: add creators stake sub banner
teodorus-nathaniel Dec 19, 2023
4a06458
feat: finish creator dashboard sidebar
teodorus-nathaniel Dec 19, 2023
12a4b2a
refactor: remove onboarding sidebar calls
teodorus-nathaniel Dec 20, 2023
f04b29c
style: move stake sub banner to sidebar
teodorus-nathaniel Dec 20, 2023
af97a76
style: make it possible for sidebar to be sticky
teodorus-nathaniel Dec 20, 2023
3565ac5
style: make gap consistent
teodorus-nathaniel Dec 20, 2023
4ce5a32
feat: finish more creators card
teodorus-nathaniel Dec 20, 2023
18fa7d8
style: make all button has medium font weight
teodorus-nathaniel Dec 20, 2023
ff231b1
feat: enable each page to customize creator sidebar content
teodorus-nathaniel Dec 21, 2023
9add081
feat: remove grill chat sidebar, now all use floating button
teodorus-nathaniel Dec 21, 2023
5df97ca
feat: pass type of dashboard for each page
teodorus-nathaniel Dec 21, 2023
eaf1c54
feat: home page dashboard variant management
teodorus-nathaniel Dec 21, 2023
409fc56
style: make image in create post card not shrinking
teodorus-nathaniel Dec 21, 2023
61c72de
feat: map sidebar for home, space, and post page
teodorus-nathaniel Dec 21, 2023
2a1f6ca
feat: add stake amount api call
teodorus-nathaniel Dec 21, 2023
e2667ac
feat: finish space page sidebar
teodorus-nathaniel Dec 21, 2023
86cd644
style: add medium font size for balance
teodorus-nathaniel Dec 21, 2023
70905a5
feat: finish creator info card in post page
teodorus-nathaniel Dec 21, 2023
924f9ec
feat: manage show get sub or stake sub card for post page
teodorus-nathaniel Dec 21, 2023
6dc83b6
feat: make stake fetch only once even if useFetch is called multiple …
teodorus-nathaniel Dec 21, 2023
8f50ed7
fix: improve logic for checking if user has stake
teodorus-nathaniel Dec 21, 2023
aef96a2
fix: not rendering stake card if user doesn't have stake
teodorus-nathaniel Dec 21, 2023
8190069
feat: add links to stake buttons
teodorus-nathaniel Dec 21, 2023
0f09e62
fix: wrong logic to check if creators is included
teodorus-nathaniel Dec 21, 2023
7d35bc3
chore: add target blank to stake button link
teodorus-nathaniel Dec 21, 2023
3f24133
fix: use correct subid url
teodorus-nathaniel Dec 22, 2023
7b8aadc
feat: add total stakes slice
teodorus-nathaniel Dec 22, 2023
22aea50
feat: add creators tab
teodorus-nathaniel Dec 22, 2023
33940a7
feat: add creators spaces tab
teodorus-nathaniel Dec 22, 2023
5143d75
feat: add functionality for create post and profile button
teodorus-nathaniel Dec 22, 2023
a6ef914
chore: remove + icon from buttons in navbar
teodorus-nathaniel Dec 22, 2023
c1c1f5d
chore: change wording
teodorus-nathaniel Dec 22, 2023
dae7600
chore: add tooltip post to earn for create post modal
teodorus-nathaniel Dec 22, 2023
e61b214
refactor: create link generator function for creators link
teodorus-nathaniel Dec 22, 2023
9b56c84
fix: use wrapper link function for generating creators link
teodorus-nathaniel Dec 22, 2023
8362d86
chore: render support creators card if space is not creators
teodorus-nathaniel Dec 22, 2023
137b2eb
feat: shuffle creator ids in creator space list
teodorus-nathaniel Dec 26, 2023
a533d78
feat: make creator sidebar sticky
teodorus-nathaniel Dec 26, 2023
58121e3
style: improve stake sub card for mobile
teodorus-nathaniel Dec 26, 2023
18dfe56
style: improve image location for mobile stake sub
teodorus-nathaniel Dec 26, 2023
f6cf607
style: improve UI for stake card and refactor isZero implementation
teodorus-nathaniel Dec 26, 2023
410858e
style: improve my stake UI for mobile
teodorus-nathaniel Dec 26, 2023
ac19cfc
style: remove space card if its rendered in sidebar
teodorus-nathaniel Dec 26, 2023
038f66a
style: add increase sub rewards data
teodorus-nathaniel Dec 26, 2023
885213f
fix: make link go to new tab
teodorus-nathaniel Dec 26, 2023
d59cda1
fix: make links go to new page
teodorus-nathaniel Dec 26, 2023
84c1098
feat: add links for active staking related buttons
teodorus-nathaniel Dec 26, 2023
d3510bc
style: update post actions style and remove dislike
teodorus-nathaniel Dec 26, 2023
c53ed58
chore: add active staking image
teodorus-nathaniel Dec 26, 2023
f9b70e9
chore: compress images
teodorus-nathaniel Dec 26, 2023
f23c596
Merge branch 'main' of https://github.com/dappforce/polkaverse into d…
teodorus-nathaniel Dec 26, 2023
52139bc
chore: update creator list to match newest data
teodorus-nathaniel Dec 26, 2023
b54a865
fix: update subid url
teodorus-nathaniel Dec 26, 2023
c3aae4c
fix: add @ for space with handle
teodorus-nathaniel Dec 26, 2023
eac6215
feat: enable open creator chat
teodorus-nathaniel Dec 26, 2023
c1edce7
chore: remove get sub banner
teodorus-nathaniel Dec 26, 2023
11a7074
feat: make user can open creator chat
teodorus-nathaniel Dec 26, 2023
00291a6
chore: update wording
teodorus-nathaniel Dec 26, 2023
8763e61
feat: make grill iframe shows from right in larger screen
teodorus-nathaniel Dec 26, 2023
9ef9916
chore: update wording
teodorus-nathaniel Dec 26, 2023
bad8f7f
style: adjust size of images
teodorus-nathaniel Dec 26, 2023
4e6bb9c
style: change style of stake sub card
teodorus-nathaniel Dec 26, 2023
8f50d26
fix: UI issues in mobile which is too wide for creator chat button
teodorus-nathaniel Dec 26, 2023
35ad973
style: change style for get more sub card
teodorus-nathaniel Dec 26, 2023
75120df
style: adjust position of stake sub card image
teodorus-nathaniel Dec 26, 2023
fea9594
refactor: rename file
teodorus-nathaniel Dec 26, 2023
e720071
style: update support creator card ui
teodorus-nathaniel Dec 26, 2023
04ff6f7
fix: make sidebar scrollable in landscape
teodorus-nathaniel Dec 26, 2023
50be25c
refactor: rename stakes feature for rtk to creators
teodorus-nathaniel Dec 26, 2023
285ba2b
feat: use data from subid for creators list
teodorus-nathaniel Dec 26, 2023
6153b0a
chore: only load card after creator data finish loading
teodorus-nathaniel Dec 27, 2023
730ba5e
chore: add href to stake sub link in create post modal
teodorus-nathaniel Dec 27, 2023
632ab51
chore: add learn more link in create post card
teodorus-nathaniel Dec 28, 2023
9ee3fa4
fix: space page not found when redirect after create space
teodorus-nathaniel Dec 28, 2023
44782cd
style: make post action in post page also in preview mode so without …
teodorus-nathaniel Dec 28, 2023
4b87c48
fix: remove local subid code
teodorus-nathaniel Dec 28, 2023
20d0994
feat: show different info panel if user has staked and not
teodorus-nathaniel Dec 28, 2023
c59ac7c
refactor: change activeStakingLinks to just obj instead of func
teodorus-nathaniel Dec 28, 2023
608eab2
feat: use current wallet as parameter for grill chat
teodorus-nathaniel Dec 28, 2023
a0862c2
chore: update tab wording
teodorus-nathaniel Dec 28, 2023
0972533
refactor: remove log
teodorus-nathaniel Dec 28, 2023
e7abf03
Update src/rtk/features/creators/stakesSlice.ts
teodorus-nathaniel Dec 28, 2023
8f2883d
refactor: remove preview props and action with labels
teodorus-nathaniel Dec 28, 2023
be372ca
style: add padding in post page action panel
teodorus-nathaniel Dec 28, 2023
a122edc
refactor: create wrapper for fetching data
teodorus-nathaniel Dec 28, 2023
33df2ca
fix: issue creator list not fetching
teodorus-nathaniel Dec 28, 2023
f57a9d2
Merge branch 'deploy/creators' of https://github.com/dappforce/polkav…
teodorus-nathaniel Dec 28, 2023
d1bca75
fix: add missing dep
teodorus-nathaniel Dec 28, 2023
30381f4
feat: add loading state before space ids are loaded
teodorus-nathaniel Dec 28, 2023
fc11e5a
feat: change meta title if post has no title
teodorus-nathaniel Dec 28, 2023
abdb355
feat: use spaceName or ownerName for title if post has no title
teodorus-nathaniel Dec 28, 2023
07bd940
fix: fetch is called too many times if req fails, because of always c…
teodorus-nathaniel Dec 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"@subsocial/api": "0.8.10",
"@subsocial/definitions": "0.8.10",
"@subsocial/elasticsearch": "0.8.10",
"@subsocial/grill-widget": "^0.0.12",
"@subsocial/resource-discussions": "^0.0.3",
"@subsocial/grill-widget": "^0.0.13",
"@subsocial/resource-discussions": "^0.0.4",
"@subsocial/utils": "0.8.10",
"@tiptap/extension-highlight": "^2.0.0-beta.33",
"@tiptap/extension-image": "^2.0.0-beta.27",
Expand All @@ -107,6 +107,7 @@
"@tiptap/pm": "^2.0.3",
"@tiptap/react": "^v2.0.0-beta.217",
"@tiptap/starter-kit": "^2.0.0-beta.184",
"@types/lodash.shuffle": "^4.2.9",
"adblock-detect-react": "^1.0.5",
"ant-design-pro": "^2.3.2",
"antd": "4.12.3",
Expand All @@ -128,6 +129,7 @@
"lodash.isempty": "^4.4.0",
"lodash.memoize": "^4.1.2",
"lodash.partition": "^4.6.0",
"lodash.shuffle": "^4.2.0",
"lodash.truncate": "^4.4.2",
"next": "11.1.4",
"next-themes": "^0.0.14",
Expand All @@ -154,6 +156,7 @@
"react-tooltip": "^4.2.19",
"sanitize-html": "^2.10.0",
"sass": "^1.26.10",
"sort-keys-recursive": "^2.1.10",
"store": "^2.0.12",
"strip-markdown": "^4.0.0",
"url-loader": "^4.1.1",
Expand Down
Binary file added public/images/creators/active-staking.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/creators/hearts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/creators/registered-creators.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/creators/subsocial-tokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/images/databases.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions src/components/chat/ChatFloatingModal.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,55 @@
opacity: 0
transform: translateY(100%)


.Position--right
.ChatContainer
align-items: flex-end

.ChatContent
max-width: 570px
width: 100%
position: relative
height: 100vh
height: 100dvh

.ChatControl
padding: 0
position: absolute
left: -40px
top: 12px
transform: rotate(-90deg)

&.ChatContainerHidden
.ChatContent
transform: translateX(100%)

.Position--bottom
.ChatContainer
&.ChatContainerHidden
.ChatContent
transform: translateY(100%)

@media ( max-width: $max_mobile_width )
.Position--right
.ChatContainer
align-items: center

.ChatContent
max-width: none
width: 100%
position: relative
height: 90vh
height: 90dvh

.ChatControl
padding: $space-tiny
top: 0
left: 0
position: relative
transform: rotate(0deg)

&.ChatContainerHidden
.ChatContent
transform: translateY(100%)

65 changes: 33 additions & 32 deletions src/components/chat/ChatFloatingModal.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { Button } from 'antd'
import clsx from 'clsx'
import { useEffect, useRef, useState } from 'react'
import { useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import { HiChevronDown } from 'react-icons/hi2'
import { useSendEvent } from 'src/providers/AnalyticContext'
import { useChatOpenState } from 'src/rtk/app/hooks'
import { useAppSelector } from 'src/rtk/app/store'
import { ChatEntity } from 'src/rtk/features/chat/chatSlice'
import { disablePageScroll, enablePageScroll } from 'src/utils/window'
import { useResponsiveSize } from '../responsive'
import styles from './ChatFloatingModal.module.sass'
import ChatIframe from './ChatIframe'

export default function ChatFloatingModal() {
const { isLargeDesktop } = useResponsiveSize()
const sendEvent = useSendEvent()
const [isOpen, setIsOpen] = useChatOpenState()
const entity = useAppSelector(state => state.chat.entity)
const withFloatingButton = useAppSelector(state => state.chat.withFloatingButton)

const [unreadCount, setUnreadCount] = useState(0)

Expand All @@ -29,27 +28,26 @@ export default function ChatFloatingModal() {
}
}, [entity])

const hasOpened = useRef(false)
useEffect(() => {
if (isOpen) disablePageScroll()
else enablePageScroll()

if (entity && isOpen) {
setUnreadCount(0)
saveUnreadCount(entity, 0)
}
}, [isOpen])

const toggleChat = () => {
let event
if (isOpen) {
event = 'close_grill_iframe'
} else {
event = 'open_grill_iframe'
setUnreadCount(0)
if (entity) saveUnreadCount(entity, 0)
}
sendEvent(event)

if (!isOpen) disablePageScroll()
else enablePageScroll()

setIsOpen(!isOpen)
hasOpened.current = true
}

if (isLargeDesktop) {
return null
}

const onUnreadCountChange = (count: number) => {
Expand All @@ -64,29 +62,32 @@ export default function ChatFloatingModal() {
return (
<>
{createPortal(
<div className={clsx(styles.ChatContainer, !isOpen && styles.ChatContainerHidden)}>
<div className={clsx(styles.ChatOverlay)} onClick={() => setIsOpen(false)} />
<div className={clsx(styles.ChatContent)}>
<div className={clsx(styles.ChatControl)}>
<Button onClick={toggleChat}>
<HiChevronDown />
</Button>
<div className={clsx(styles['Position--right'])}>
<div className={clsx(styles.ChatContainer, !isOpen && styles.ChatContainerHidden)}>
<div className={clsx(styles.ChatOverlay)} onClick={() => setIsOpen(false)} />
<div className={clsx(styles.ChatContent)}>
<div className={clsx(styles.ChatControl)}>
<Button onClick={toggleChat}>
<HiChevronDown />
</Button>
</div>
<ChatIframe onUnreadCountChange={onUnreadCountChange} className={styles.ChatIframe} />
</div>
<ChatIframe onUnreadCountChange={onUnreadCountChange} className={styles.ChatIframe} />
</div>
</div>,
document.body,
)}
{createPortal(
<div className={styles.ChatFloatingWrapper}>
<Button className={styles.ChatFloatingButton} onClick={toggleChat}>
<img src='/images/grillchat.svg' alt='GrillChat' />
<span>Comments</span>
</Button>
{!!unreadCount && <span className={styles.ChatUnreadCount}>{unreadCount}</span>}
</div>,
document.body,
)}
{withFloatingButton &&
createPortal(
<div className={styles.ChatFloatingWrapper}>
<Button className={styles.ChatFloatingButton} onClick={toggleChat}>
<img src='/images/grillchat.svg' alt='GrillChat' />
<span>Comments</span>
</Button>
{!!unreadCount && <span className={styles.ChatUnreadCount}>{unreadCount}</span>}
</div>,
document.body,
)}
</>
)
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/chat/ChatIframe.module.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.ChatIframe
transition: opacity 150ms ease-out
opacity: 1

&.ChatIframeLoading
opacity: 0
Loading