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

🟣 Release 5.2.0 #6203

Merged
merged 108 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
7b96fc9
🔥 Resolve more package version conflicts
WRadoslaw Mar 13, 2024
203b7c7
🔥Fix video cache
WRadoslaw Mar 9, 2024
93f7470
🔥Fix skip check on video view
WRadoslaw Mar 9, 2024
4959a0c
🔥Remove lang filtering and adjust short filtering
WRadoslaw Mar 8, 2024
26e0bab
🌙 CRT Generic Drawer (#4467)
WRadoslaw Jul 26, 2023
4341cd3
🛝 CRT Ratio Slider (#4470)
thesan Jul 26, 2023
2e72ca4
🌳 CRT progress widget (#4569)
WRadoslaw Aug 13, 2023
eefbe31
🇩🇪 Create token flow (#4564)
WRadoslaw Aug 13, 2023
5f889e2
💨 CRT dashboard setup (#4576)
WRadoslaw Aug 13, 2023
d5beff9
📹 Video trailer picker (#4622)
WRadoslaw Aug 13, 2023
65844b2
:octocat: CRT flow previews (#4692)
WRadoslaw Aug 22, 2023
beedf58
😄 Benefit list item (#4644)
WRadoslaw Aug 22, 2023
382fa99
📝 Markdown editor (#4681)
thesan Aug 23, 2023
9c65519
🕐 Timer hook (#4709)
WRadoslaw Aug 28, 2023
e271186
🪙 Token details tab (#4735)
WRadoslaw Aug 28, 2023
4ff1bfc
💱 CRT transaction table component (#4752)
thesan Aug 28, 2023
f0de0b0
💸 Buy token on sale modal (#4728)
WRadoslaw Aug 28, 2023
636deef
Switch single pause into polling for timer test (#4763)
WRadoslaw Aug 29, 2023
a2a62ce
🧬 Sell token modal (#4753)
WRadoslaw Aug 29, 2023
5db02ce
🦅 Buy token from market modal (#4747)
WRadoslaw Aug 30, 2023
3a289cf
🔢 Adjust number format for CRT (#4773)
WRadoslaw Aug 30, 2023
4d2456a
🇲🇴 Market widget (#4769)
WRadoslaw Aug 31, 2023
7da1cf4
✔️ Close market modal (#4767)
WRadoslaw Aug 31, 2023
b43287e
🩹 Holders table (#4794)
WRadoslaw Sep 5, 2023
7a15457
🕳️ Holders widget (#4780)
WRadoslaw Sep 8, 2023
ba4c4d5
📹 Portfolio view (#4784)
WRadoslaw Sep 8, 2023
b245d88
🚦 CRT Token status widget (#4731)
thesan Sep 13, 2023
da9bb32
👨 CRT header widget (#4693)
WRadoslaw Sep 14, 2023
5896bbe
🧑‍🏭 Bring all CRT transactions into worker (#4859)
WRadoslaw Sep 14, 2023
68775aa
🧾 Revenue share widget (#4857)
WRadoslaw Sep 15, 2023
d0a5310
🍶 CRT revenue tab (#4867)
WRadoslaw Sep 20, 2023
23488ad
🚡 Claim share modal (#4885)
WRadoslaw Sep 21, 2023
2515e1e
😵‍💫 Crt holders widget and pie chart (#4897)
WRadoslaw Sep 26, 2023
837bf4f
🧇 Unlock revenue share (#4906)
WRadoslaw Sep 26, 2023
9a05180
🍶 Create token transaction (#4912)
WRadoslaw Oct 5, 2023
e462249
😮‍💨 Start revenue share modal (#4869)
WRadoslaw Oct 10, 2023
fbf4b98
🎬 Close revenue share (#4909)
WRadoslaw Oct 11, 2023
bf6b5d7
🥋 Buy token market tx (#4946)
WRadoslaw Oct 12, 2023
c67aea6
Crt market start (#4884)
attemka Oct 12, 2023
3d9265f
🚡 Revenue share state widget (#4998)
WRadoslaw Oct 12, 2023
36e637a
🪂 Revenue share participation widget (#5003)
WRadoslaw Oct 12, 2023
b132181
🦭 Sell tokens amm transaction (#4954)
WRadoslaw Oct 16, 2023
6ba4bb3
🧰 CRT Maintenance (#4997)
WRadoslaw Oct 16, 2023
22c31e8
🧑‍🚀 Initial CRT dashboard - orion integration (#5024)
WRadoslaw Oct 17, 2023
be39f53
😮‍💨 Start market modal (#5048)
WRadoslaw Oct 31, 2023
dac8f16
👁️ Token edit, preview, view (#5060)
WRadoslaw Nov 6, 2023
0f60792
🤑 Buy sell amm (#5135)
WRadoslaw Nov 13, 2023
a0d320c
✌️ CRT follow up v1 (#5277)
WRadoslaw Nov 13, 2023
db5ef60
〽️ CRT trade dialogs (#5335)
WRadoslaw Nov 15, 2023
4af626c
🇦🇨 Revenue share widget on dashboard (#5186)
WRadoslaw Nov 21, 2023
443bcb4
⛓️ Channel token view (#5341)
WRadoslaw Nov 21, 2023
4416fdd
🤯 Portfolio rework (#5370)
WRadoslaw Nov 22, 2023
e8e767c
🥈 CRT follow up v2 (#5412)
WRadoslaw Nov 22, 2023
9c56a8e
🥇 CRT QA v1 (#5430)
WRadoslaw Nov 22, 2023
e69ea4a
Fix error with holder veting access (#5560)
WRadoslaw Dec 6, 2023
d3c9cdb
🥈 CRT QA v2 (#5512)
WRadoslaw Dec 7, 2023
8fadb89
🔍 Market tab (#5511)
WRadoslaw Dec 7, 2023
2a98571
🥉 CRT QA v3 (#5596)
WRadoslaw Dec 7, 2023
c554a7a
🐰 Sentry logs for CRT (#5619)
attemka Dec 11, 2023
dd6c764
🍀 CRT QA v4 (#5621)
WRadoslaw Dec 11, 2023
525f1bb
5️⃣ CRT QA v5 (#5640)
WRadoslaw Dec 13, 2023
2c801ab
Minor fix in Atlas config (#5649)
attemka Dec 13, 2023
7f3942e
☁️ New tooltips for CRT (#5635)
WRadoslaw Dec 15, 2023
aadb2ad
🕷️ Add loading states for CRT (#5664)
WRadoslaw Dec 15, 2023
892cac7
🎓 CRT Marketplace scaffold (#5674)
WRadoslaw Dec 19, 2023
9c3f269
🗂️ CRT Marketplace Card (#5680)
WRadoslaw Dec 20, 2023
a3e7c77
🎠 CRT carousel item (#5684)
WRadoslaw Dec 23, 2023
6aca292
🪙 Marketplace tokens table (#5685)
WRadoslaw Dec 23, 2023
6e7650b
🔝 Top selling channel with token (#5689)
WRadoslaw Dec 27, 2023
08d0383
6️⃣ CRT QA v6 (#5677)
WRadoslaw Dec 28, 2023
31a4797
🗼 Total channel revenue (#5705)
WRadoslaw Dec 29, 2023
53ec1a4
🐲 CRT small UI follow ups (#5860)
WRadoslaw Feb 7, 2024
428a8a8
🌚 Regenerate queries
WRadoslaw Mar 5, 2024
f7c3bff
🔧 Post rebase fixes
WRadoslaw Mar 5, 2024
7a03346
😵‍💫 Cancel modal and general UI improvements (#5952)
WRadoslaw Mar 6, 2024
ef71ed3
✉️ CRT Notifications (#5972)
WRadoslaw Mar 11, 2024
4e5917c
🦅 Supply participation info while using AMM UI (#5973)
WRadoslaw Mar 11, 2024
1f3d4f7
🌑 New AMM approach (#5995)
WRadoslaw Mar 14, 2024
b194a2e
🛕 Temporarily hide Learn more buttons (#5996)
WRadoslaw Mar 14, 2024
ef84f0e
🌚 Regenerate lock and schema
WRadoslaw Mar 14, 2024
2309356
🏰 Remove useless type casts
WRadoslaw Mar 14, 2024
278b8d4
📁 Fix account follow logic (#6015)
WRadoslaw Mar 17, 2024
9ac9024
💸 ChangeNow integration (#5977)
WRadoslaw Mar 18, 2024
e720e23
🐎 ChangeNOW modal adjustements (#6016)
WRadoslaw Mar 18, 2024
98b432e
✊ Powered by Joystream (#6031)
WRadoslaw Mar 20, 2024
84ad7ce
👲 Allow user to increase bid without withdrawal (#6029)
WRadoslaw Mar 20, 2024
eab16f8
🐾 CRT creator feedback fixes (#6005)
WRadoslaw Mar 27, 2024
5fad416
🍕 Segment analytics for CRT (#6040)
attemka Mar 29, 2024
75080d3
🏆 Remove user context usage in embedded player (#6070)
WRadoslaw Apr 2, 2024
e9aeb87
🌵 Add CMC previews support (#5934)
kdembler Apr 2, 2024
4328f50
😨 ChangeNOW modal adjustements v2 (#6041)
WRadoslaw Apr 2, 2024
9a50212
😢 CRT followup 2 (#6073)
WRadoslaw Apr 5, 2024
4f53cc3
🍭 CRT UTM parameters (#6106)
attemka Apr 9, 2024
9b50ea8
🥈 CRT segment events modifications (#6105)
attemka Apr 9, 2024
3f57adc
🧑‍🚀 Action refetching (#6118)
WRadoslaw Apr 9, 2024
8a105a3
📡 CRT cosmetic changes (#6138)
WRadoslaw Apr 10, 2024
96883a1
🫀 Added portfolio segment analytics (#6140)
attemka Apr 12, 2024
b92bc36
🦀 CRT Marketplace minor fixes (#6159)
WRadoslaw Apr 12, 2024
f49c5ac
🙈 Fix for UTM params scrape (#6176)
attemka Apr 15, 2024
a047b1d
🦚 Store persistence for utm params (#6177)
attemka Apr 16, 2024
f7ebea3
☁️ Improve JOY token tooltip info (#6128)
kdembler Apr 16, 2024
31dffdb
↕️ CRT marketplace improvements (#6181)
WRadoslaw Apr 17, 2024
a64e9cc
😵‍💫 Possibly fix token balance hook (#6184)
WRadoslaw Apr 18, 2024
0d66344
🥉 Change now modal fixes v3 (#6193)
WRadoslaw Apr 22, 2024
d5c640b
🤔 Learn more link for CRT (#6192)
WRadoslaw Apr 22, 2024
a80971d
⏏️ Fix changenow submit button (#6201)
WRadoslaw Apr 22, 2024
9e90a22
💹 Post rebase lock file regen
WRadoslaw Apr 22, 2024
7410fb9
⬆️ Bump version and adjust changelog
WRadoslaw Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = {
importOrderParserPlugins: ['jsx', 'typescript'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
'plugins': ['@trivago/prettier-plugin-sort-imports'],
plugins: ['@trivago/prettier-plugin-sort-imports'],
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.2.0] - 2024-04-22

### Added

- CRT features
- ChangeNOW integration
- Powered by Joystream label

### Fixed

- Embedded player ending screen

## [5.1.0] - 2024-04-18

- New types for Luxor network release
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@polkadot/types": "10.7.1",
"@polkadot/util": "12.6.2",
"@polkadot/util-crypto": "12.6.2",
"@polkadot/networks": "9.5.1",
"@polkadot/networks": "12.6.2",
"@polkadot/x-fetch": "9.5.1",
"@polkadot/x-global": "9.5.1",
"@polkadot/x-ws": "9.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas-proxy-worker/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const CRAWLER_USER_AGENT_REGEX =
/googlebot|YandexBot|baiduspider|twitterbot|facebookexternalhit|discordbot|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator|Rocket.Chat|Minds|Taringa|redditbot/i
/googlebot|YandexBot|baiduspider|twitterbot|facebookexternalhit|discordbot|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator|Rocket.Chat|Minds|Taringa|redditbot|HeadlessChrome/i

declare global {
const ATLAS_URL: string
Expand Down
10 changes: 9 additions & 1 deletion packages/atlas/atlas.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ general:
joystreamLandingPageUrl: 'https://www.joystream.org' # URL for Joystream landing page - used in the footer and in "Learn more" links
joystreamDiscordUrl: 'https://discord.gg/DE9UN3YpRP' # URL for Joystream Discord - used for support when errors occur
appContentFocus: 'web3 & crypto' # Content focus of given app. Provide a string, for example `web & crypto` or `sport`
crtMaintenanceMode: false
storage:
assetResponseTimeout: 2_000 # Timeout for asset response in ms - after this timeout, different distributor will be tried
assetUploadStatusPollingInterval: 2000 # Interval for polling asset upload status in ms - polling begins once asset is uploaded and is finished once QN reports the asset as accepted
Expand Down Expand Up @@ -237,7 +238,7 @@ features:

Your use of our Services is at your sole risk. Our Services are provided “as is" and “as available" without warranties of any kind, either express or implied, including, but not limited to, implied warranties of merchantability, fitness for a particular purpose, title, and non-infringement. In addition, the Company does not represent or warrant that our Services are accurate, complete, reliable, current or error-free. While the Company attempts to make your access to and use of our Services safe, we cannot and do not represent or warrant that our Services or servers are free of viruses or other harmful components. You assume the entire risk as to the quality and performance of the Services.

Manual process is involved, so errors are not inevitable. JSG team is not liable for any reconciliations, but is committed to spend reasonable efforts to support all participants in reconciliation of rewards calculation where it deems to be operationally viable and commercially sensible to do so.
Manual process is involved, so errors are not inevitable. JSG team is not liable for any reconciliations, but is committed to spend reasonable efforts to support all participants in reconciliation of rewards calculation where it deems to be operationally viable and commercially sensible to do so.

JSG team is not liable or obliged to do the payments and in case of errors will seek to provide the support in reconciliation of payments but not be obliged for channel rewards. In case of any disputes over content quality and qualification for rewards, JSG has no liability to compensate the channels and these terms are not binding, but payouts are made on total discretion of the $VITE_APP_NAME App operator and the JS Genesis AS team. In case program budget runs out before some of the apps are paid, there is no obligation to pay late subscribers.

Expand Down Expand Up @@ -568,6 +569,13 @@ analytics:
id: '$VITE_SEGMENT_ID'

legal:
crtTnc: |
By buying this token:
- You have right to own it, hold it, sell it and transfer to any other wallet.
- You can sell your token to the AMM if the AMM becomes enabled at any moment.

Holders rights:
Proin urna volutpat pharetra, tellus. Quam purus integer tempus habitant volutpat pellentesque.
termsOfService: |
# Terms of Service

Expand Down
25 changes: 15 additions & 10 deletions packages/atlas/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/atlas",
"description": "UI for consuming Joystream - a user governed video platform",
"version": "5.1.0",
"version": "5.2.0",
"license": "GPL-3.0",
"scripts": {
"start": "vite",
Expand Down Expand Up @@ -39,12 +39,13 @@
"@hcaptcha/react-hcaptcha": "^1.4.4",
"@hookform/resolvers": "^2.9.10",
"@joystream/js": "^1.4.0",
"@joystream/metadata-protobuf": "2.8.1",
"@joystream/metadata-protobuf": "2.9.0",
"@joystream/types": "4.5.0",
"@livesession/sdk": "^1.1.4",
"@loadable/component": "^5.15.2",
"@lottiefiles/react-lottie-player": "^3.5.0",
"@nivo/line": "^0.83.0",
"@nivo/pie": "^0.83.0",
"@segment/analytics-next": "^1.53.0",
"@sentry/react": "^7.53.1",
"@talismn/connect-wallets": "^1.2.1",
Expand Down Expand Up @@ -72,6 +73,7 @@
"mp4box": "^0.5.2",
"multihashes": "^4.0.3",
"postcss-syntax": "^0.36.2",
"qrcode.react": "^3.1.0",
"rc-slider": "^10.1.0",
"react": "^18.2.0",
"react-datepicker": "^4.8.0",
Expand All @@ -95,6 +97,9 @@
"react-transition-group": "^4.4.5",
"retry-axios": "^3.0.0",
"scroll-lock": "^2.1.5",
"slate": "^0.94.1",
"slate-history": "^0.93.0",
"slate-react": "^0.98.1",
"subscriptions-transport-ws": "^0.11.0",
"swiper": "^9.1.1",
"twemoji": "^14.0.2",
Expand All @@ -116,13 +121,13 @@
"@modyfi/vite-plugin-yaml": "^1.0.3",
"@rollup/plugin-babel": "^6.0.3",
"@sentry/vite-plugin": "^2.5.0",
"@storybook/addon-actions": "7.0.7",
"@storybook/addon-docs": "7.0.7",
"@storybook/addon-essentials": "7.0.7",
"@storybook/addon-links": "7.0.7",
"@storybook/addons": "7.0.7",
"@storybook/react-vite": "7.0.7",
"@storybook/theming": "7.0.7",
"@storybook/addon-actions": "7.4.6",
"@storybook/addon-docs": "7.4.6",
"@storybook/addon-essentials": "7.4.6",
"@storybook/addon-links": "7.4.6",
"@storybook/addons": "7.4.6",
"@storybook/react-vite": "7.4.6",
"@storybook/theming": "7.4.6",
"@svgr/cli": "^6.5.1",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.16.5",
Expand Down Expand Up @@ -150,7 +155,7 @@
"react-hooks-testing-library": "^0.6.0",
"rimraf": "^3.0.2",
"rollup-plugin-visualizer": "^5.9.2",
"storybook": "7.0.7",
"storybook": "7.4.6",
"style-dictionary": "^3.7.1",
"vite": "^4.3.9",
"vite-plugin-checker": "^0.5.2",
Expand Down
1 change: 1 addition & 0 deletions packages/atlas/src/.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ VITE_AVATAR_SERVICE_URL=https://atlas-services.joystream.org/avatars
VITE_ASSET_LOGS_URL=
VITE_GEOLOCATION_SERVICE_URL=https://geolocation.joystream.org
VITE_HCAPTCHA_SITE_KEY=41cae189-7676-4f6b-aa56-635be26d3ceb
VITE_CHANGENOW_PUBLIC_API_KEY=0d8a58104f82b860a70e9460bccf62ae1e0fca4a93fd7e0c27c90448187b988f

# YPP configuration
VITE_GOOGLE_CONSOLE_CLIENT_ID=246331758613-rc1psegmsr9l4e33nqu8rre3gno5dsca.apps.googleusercontent.com
Expand Down
47 changes: 25 additions & 22 deletions packages/atlas/src/CommonProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AdminModal } from '@/components/_overlays/AdminModal'
import { OperatorsContextProvider } from '@/providers/assets/assets.provider'
import { AuthProvider } from '@/providers/auth/auth.provider'
import { ConfirmationModalProvider } from '@/providers/confirmationModal'
import { NetworkUtilsProvider } from '@/providers/networkUtils/networkUtils.provider'
import { OverlayManagerProvider } from '@/providers/overlayManager'
import { SegmentAnalyticsProvider } from '@/providers/segmentAnalytics/segment.provider'
import { UserProvider } from '@/providers/user/user.provider'
Expand All @@ -33,28 +34,30 @@ export const CommonProviders: FC<PropsWithChildren> = ({ children }) => {
return (
<>
<GlobalStyles />
<SegmentAnalyticsProvider>
<ApolloProvider client={apolloClient}>
<QueryClientProvider client={queryClient}>
<WalletProvider>
<AuthProvider>
<UserProvider>
<OverlayManagerProvider>
<ConfirmationModalProvider>
<BrowserRouter>
<AdminModal />
<MaintenanceWrapper>
<OperatorsContextProvider>{children}</OperatorsContextProvider>
</MaintenanceWrapper>
</BrowserRouter>
</ConfirmationModalProvider>
</OverlayManagerProvider>
</UserProvider>
</AuthProvider>
</WalletProvider>
</QueryClientProvider>
</ApolloProvider>
</SegmentAnalyticsProvider>
<BrowserRouter>
<SegmentAnalyticsProvider>
<ApolloProvider client={apolloClient}>
<QueryClientProvider client={queryClient}>
<WalletProvider>
<AuthProvider>
<UserProvider>
<NetworkUtilsProvider>
<OverlayManagerProvider>
<ConfirmationModalProvider>
<AdminModal />
<MaintenanceWrapper>
<OperatorsContextProvider>{children}</OperatorsContextProvider>
</MaintenanceWrapper>
</ConfirmationModalProvider>
</OverlayManagerProvider>
</NetworkUtilsProvider>
</UserProvider>
</AuthProvider>
</WalletProvider>
</QueryClientProvider>
</ApolloProvider>
</SegmentAnalyticsProvider>
</BrowserRouter>
</>
)
}
Expand Down
60 changes: 59 additions & 1 deletion packages/atlas/src/api/client/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
QueryChannelsConnectionArgs,
QueryCommentsConnectionArgs,
QueryOwnedNftsConnectionArgs,
QueryTokenAccountsArgs,
QueryVideosConnectionArgs,
VideosConnection,
} from '../queries/__generated__/baseTypes.generated'
Expand Down Expand Up @@ -41,6 +42,7 @@ const getVideoKeyArgs = (
const durationLte = args?.where?.duration_gte || ''
const titleContains = args?.where?.title_contains || ''
const titleContainsInsensitive = args?.where?.title_containsInsensitive || ''
const OR = stringifyValue(args?.where?.OR)

const sortingArray = args?.orderBy != null ? (Array.isArray(args.orderBy) ? args.orderBy : [args.orderBy]) : []
const sorting = stringifyValue(sortingArray)
Expand All @@ -50,7 +52,7 @@ const getVideoKeyArgs = (
return `${createdAtGte}:${channel}`
}

return `${onlyCount}:${channel}:${category}:${nft}:${language}:${createdAtGte}:${createdAtLte}:${isPublic}:${idEq}:${idIn}:${sorting}:${durationGte}:${durationLte}:${titleContains}:${titleContainsInsensitive}:${offset}:${createdAtGt}:${createdAtLt}`
return `${onlyCount}:${channel}:${category}:${nft}:${language}:${createdAtGte}:${createdAtLte}:${isPublic}:${idEq}:${idIn}:${sorting}:${durationGte}:${durationLte}:${titleContains}:${titleContainsInsensitive}:${offset}:${createdAtGt}:${createdAtLt}:${OR}`
}

const getNftKeyArgs = (
Expand Down Expand Up @@ -78,6 +80,24 @@ const getNftKeyArgs = (
return `${OR}:${AND}:${ownerMember}:${creatorChannel}:${status}:${auctionStatus}:${sorting}:${createdAtGte}:${createdAtLte}:${video}:${offset}:${lastSalePriceGte}:${lastSalePriceLte}`
}

const getTokenAccountsKeyArgs = (
args: Partial<QueryTokenAccountsArgs> | null,
ctx: {
variables?: Record<string, unknown>
fieldName: string
}
) => {
const offset = ctx?.variables?.offset ?? ''
const limit = ctx?.variables?.limit ?? ''
const OR = stringifyValue(args?.where?.OR)
const AND = stringifyValue(args?.where?.AND)
const sortingArray = args?.orderBy != null ? (Array.isArray(args.orderBy) ? args.orderBy : [args.orderBy]) : []
const sorting = stringifyValue(sortingArray)
const where = stringifyValue(args?.where ?? {})

return `${OR}:${AND}:${sorting}:${offset}:${where}:${limit}`
}

const getChannelKeyArgs = (args: Partial<QueryChannelsConnectionArgs> | null) => {
// make sure queries asking for a specific category are separated in cache
const language = stringifyValue(args?.where?.language_eq)
Expand Down Expand Up @@ -224,6 +244,44 @@ const queryCacheFields: CachePolicyFields<keyof Query> = {
})
)
},
tokenAccounts: {
...offsetLimitPagination(getTokenAccountsKeyArgs),
read(existing, { args, toReference, canRead }) {
if (args?.where?.id_eq) {
const holderRef = toReference({
__typename: 'TokenAccount',
id: args?.where.id_eq,
})
if (canRead(holderRef)) {
return [holderRef]
} else {
return undefined
}
}
const offset = args?.offset ?? 0
const limit = args?.limit ?? existing?.length
return existing?.slice(offset, offset + limit)
},
},
getAccountTransferrableBalance: (existing, { toReference, args }) => {
return (
existing ||
toReference({
__typename: 'GetAccountTransferrableBalanceResult',
memberId: args?.memberId,
tokenId: args?.tokenId,
})
)
},
creatorTokenById: (existing, { toReference, args }) => {
return (
existing ||
toReference({
__typename: 'CreatorToken',
id: args?.id,
})
)
},
commentById: (existing, { toReference, args }) => {
return (
existing ||
Expand Down
10 changes: 10 additions & 0 deletions packages/atlas/src/api/hooks/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
useUnfollowChannelMutation,
} from '@/api/queries/__generated__/channels.generated'
import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
import { useAuth } from '@/providers/auth/auth.hooks'

export const useBasicChannel = (
id: string,
Expand Down Expand Up @@ -143,6 +144,7 @@ export const useMostPaidChannels = (): { channels: PayeeChannel[] | undefined; l

export const useFollowChannel = (opts?: MutationHookOptions<FollowChannelMutation>) => {
const [followChannel, rest] = useFollowChannelMutation()
const { refetchCurrentUser } = useAuth()
const { trackChannelFollow } = useSegmentAnalytics()
return {
followChannel: (id: string) => {
Expand All @@ -152,6 +154,9 @@ export const useFollowChannel = (opts?: MutationHookOptions<FollowChannelMutatio
variables: {
channelId: id,
},
onCompleted: () => {
refetchCurrentUser().catch(() => undefined)
},
update: (cache, mutationResult) => {
cache.modify({
id: cache.identify({
Expand All @@ -171,13 +176,18 @@ export const useFollowChannel = (opts?: MutationHookOptions<FollowChannelMutatio

export const useUnfollowChannel = (opts?: MutationHookOptions<UnfollowChannelMutation>) => {
const [unfollowChannel, rest] = useUnfollowChannelMutation()
const { refetchCurrentUser } = useAuth()

return {
unfollowChannel: (id: string) =>
unfollowChannel({
...opts,
variables: {
channelId: id,
},
onCompleted: () => {
refetchCurrentUser().catch(() => undefined)
},
update: (cache, mutationResult) => {
cache.modify({
id: cache.identify({
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas/src/api/hooks/dataObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useDataObjectsAvailabilityLazy = (opts?: QueryHookOptions<GetDataOb

const _getDataObjectsAvailability = useCallback(
(ids: string[]) => {
getDataObjectsAvailability({
return getDataObjectsAvailability({
variables: {
id_in: ids,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/atlas/src/api/hooks/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
useGetMostViewedVideosConnectionQuery,
useGetVideosCountQuery,
} from '@/api/queries/__generated__/videos.generated'
import { publicCryptoVideoFilter } from '@/config/contentFilter'
import { getPublicCryptoVideoFilter } from '@/config/contentFilter'

export const useFullVideo = (
id: string,
Expand Down Expand Up @@ -48,7 +48,7 @@ export const useChannelPreviewVideos = (
const { data, ...rest } = useGetBasicVideosQuery({
...opts,
variables: {
where: { ...publicCryptoVideoFilter, channel: { id_eq: channelId } },
where: getPublicCryptoVideoFilter({ channel: { id_eq: channelId } }),
orderBy: VideoOrderByInput.CreatedAtDesc,
offset: 0,
limit: 10,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading