Skip to content

Commit

Permalink
Gleev v4.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem authored and Artem committed Nov 8, 2023
2 parents ee6e62e + 9a474ec commit 4d9a10a
Show file tree
Hide file tree
Showing 83 changed files with 2,236 additions and 368 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ 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).

## [4.13.0] - 2023-11-08

### Added

- new Referrals page

### Changed

- YPP channel carousel is now showing most paid channels
- Removed YPP signup quota check

### Fixed

- Fixed password suggestion being shown in the wrong places
- Fixed issue with channel asset upload
- Fixed NFT button being available for unauthorized users
- Fixed incorrect block number in payments table
- Fixed avatars on NFT carousel

## [4.12.0] - 2023-11-01

### Changed
Expand Down
4 changes: 3 additions & 1 deletion packages/atlas/atlas.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ joystream:
features:
ypp:
yppDelayThreshold: 300 # When the YPP sync backlog exceeds the threshold, Atlas will consider the YPP sync delayed.
dailySignupQuota: 1250 # Daily quota for YPP signups. Leave null for unlimited quota.
landingPageOgTitle: null # Open graph title for YPP landing page - used in open graph meta tags in HTML
landingPageOgDescription: null # Open graph description for YPP landing page - used in open graph meta tags in HTML
landingPageOgImgPath: null # Path to the open graph image for the YPP landing page - if not set, the default image will be used
Expand Down Expand Up @@ -264,6 +263,9 @@ features:
statusPollingInterval: 20000 # Interval for polling NFT status on VideoView in ms
notifications:
pollingInterval: 10000 # Interval for polling notifications in ms
referrals:
referrerBonusPercent: 5 # How much referrer would get from the invitee reward
signupBonusPercent: 5 # How much invitee would get from the referral link signup
members:
avatarServiceUrl: '$VITE_AVATAR_SERVICE_URL' # URL for avatar service - used to upload member's avatar
hcaptchaSiteKey: '$VITE_HCAPTCHA_SITE_KEY' # Site key for hCaptcha - used to verify users are not bots when creating memberships - depends on hCaptcha being enabled in the faucet
Expand Down
6 changes: 4 additions & 2 deletions packages/atlas/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { CodegenConfig } from '@graphql-codegen/cli'

import { customSchemaLoader } from './scripts/customSchemaLoader'

const schemaUrl = 'https://orion.gleev.xyz/graphql'
const ENV = process.env.VITE_DEFAULT_DATA_ENV?.toUpperCase() ?? process.env.VITE_ENV?.toUpperCase() ?? 'PRODUCTION'
const schemaUrl = process.env[`VITE_${ENV}_ORION_URL`]
if (!schemaUrl) throw new Error(`VITE_${ENV}_ORION_URL is not defined`)

const config: CodegenConfig = {
overwrite: true,
Expand All @@ -13,7 +15,7 @@ const config: CodegenConfig = {
[schemaUrl]: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
loader: customSchemaLoader,
loader: customSchemaLoader(schemaUrl),
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/atlas/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@joystream/atlas",
"description": "UI for consuming Joystream - a user governed video platform",
"version": "4.12.0",
"version": "4.13.0",
"license": "GPL-3.0",
"scripts": {
"start": "vite",
"dev": "vite",
"dev": "vite --host",
"build": "vite build",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build -o dist-storybook",
Expand Down
60 changes: 20 additions & 40 deletions packages/atlas/scripts/customSchemaLoader.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
import axios from 'axios'
import { buildClientSchema, getIntrospectionQuery } from 'graphql'

async function fetchAuthCookie() {
const response = await axios.post(
`https://auth.gleev.xyz/api/v1/anonymous-auth`,
{},
{
method: 'POST',
withCredentials: true,
headers: {
'Content-Type': 'application/json',
},
}
)
export function customSchemaLoader(schemaUrl: string) {
return async () => {
const introspectionQuery = getIntrospectionQuery()

return response.headers['set-cookie']
}

export async function customSchemaLoader() {
const authCookie = await fetchAuthCookie()
const introspectionQuery = getIntrospectionQuery()

if (!authCookie) {
throw new Error('Authorization cookie is missing.')
}

const schemaResponse = await axios
.post<any>(
'https://orion.gleev.xyz/graphql',
{
query: introspectionQuery,
},
{
method: 'post',
withCredentials: true,
headers: {
Cookie: authCookie.join('; '),
'Content-Type': 'application/json',
const schemaResponse = await axios
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.post<any>(
schemaUrl,
{
query: introspectionQuery,
},
}
)
.catch((error) => console.log(error.response.data))
const schema = buildClientSchema(schemaResponse && schemaResponse.data.data)
return schema
{
method: 'post',
withCredentials: true,
headers: { 'Content-Type': 'application/json' },
}
)
// eslint-disable-next-line no-console
.catch((error) => console.log(error.response.data))
const schema = buildClientSchema(schemaResponse && schemaResponse.data.data)
return schema
}
}
6 changes: 4 additions & 2 deletions packages/atlas/src/.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ VITE_HCAPTCHA_SITE_KEY=41cae189-7676-4f6b-aa56-635be26d3ceb

# YPP configuration
VITE_GOOGLE_CONSOLE_CLIENT_ID=246331758613-rc1psegmsr9l4e33nqu8rre3gno5dsca.apps.googleusercontent.com
VITE_YOUTUBE_SYNC_API_URL=https://50.19.175.219.nip.io
VITE_YOUTUBE_SYNC_API_URL=https://35.156.81.207.nip.io
VITE_YOUTUBE_COLLABORATOR_MEMBER_ID=18

# Analytics tools
Expand Down Expand Up @@ -54,9 +54,11 @@ VITE_NEXT_FAUCET_URL=https://atlas-next.joystream.org/member-faucet/register
VITE_NEXT_YPP_FAUCET_URL=https://52.204.147.11.nip.io/membership

# Local development env URLs
VITE_LOCAL_ORION_URL=http://localhost:6116/graphql
VITE_LOCAL_ORION_AUTH_URL=http://localhost:4074/api/v1
VITE_LOCAL_ORION_URL=http://localhost:4350/graphql
VITE_LOCAL_QUERY_NODE_SUBSCRIPTION_URL=ws://localhost:8081/graphql
VITE_LOCAL_NODE_URL=ws://localhost:9944/ws-rpc
VITE_LOCAL_FAUCET_URL=http://localhost:3002/register
VITE_LOCAL_YPP_FAUCET_URL=https://52.204.147.11.nip.io/membership

VITE_SENTRY_AUTH_TOKEN=
47 changes: 16 additions & 31 deletions packages/atlas/src/api/hooks/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import {
UnfollowChannelMutation,
useFollowChannelMutation,
useGetChannelNftCollectorsQuery,
useGetChannelsPaymentEventsQuery,
useGetDiscoverChannelsQuery,
useGetExtendedBasicChannelsQuery,
useGetExtendedFullChannelsQuery,
useGetMostPaidChannelsQuery,
useGetTop10ChannelsQuery,
useUnfollowChannelMutation,
} from '@/api/queries/__generated__/channels.generated'
Expand Down Expand Up @@ -84,40 +84,25 @@ export const useBasicChannels = (
}
}

type PayeeChannel = {
export type PayeeChannel = {
id: string
title?: string | null
cumulativeRewardPaid: BN
avatarPhoto?: { resolvedUrls: string[] } | null
}
export type YPPPaidChannels = { channel: PayeeChannel; amount: BN }
export const useRecentlyPaidChannels = (): { channels: YPPPaidChannels[] | undefined; loading: boolean } => {
const { data, loading } = useGetChannelsPaymentEventsQuery({ variables: { limit: 2000 } })

const channels = useMemo<YPPPaidChannels[] | undefined>(() => {
type PaymentMap = Map<string, YPPPaidChannels>
const paymentMap = data?.events.reduce<PaymentMap>((channels, { data }) => {
if (data.__typename !== 'ChannelPaymentMadeEventData' || !data.payeeChannel) return channels

const exisitng = channels.get(data.payeeChannel.id)
const channel = exisitng?.channel ?? data.payeeChannel
const amount = new BN(data.amount).add(exisitng?.amount ?? BN_ZERO)

channels.set(data.payeeChannel.id, { channel, amount })

return channels
}, new Map())

return (
paymentMap &&
Array.from(paymentMap.values())
.sort((a, b) => {
if (a.amount.gt(b.amount)) return -1
if (a.amount.lt(b.amount)) return 1
return 0
})
.slice(0, 50)
)
}, [data])
export const useMostPaidChannels = (): { channels: PayeeChannel[] | undefined; loading: boolean } => {
const { data, loading } = useGetMostPaidChannelsQuery()

const channels = useMemo<PayeeChannel[] | undefined>(
() =>
data?.channels.map(({ id, title, cumulativeRewardPaid, avatarPhoto }) => ({
id,
title: title ?? undefined,
cumulativeRewardPaid: cumulativeRewardPaid ? new BN(cumulativeRewardPaid) : BN_ZERO,
avatarPhoto: avatarPhoto ?? undefined,
})),
[data]
)

return { channels, loading }
}
Expand Down

0 comments on commit 4d9a10a

Please sign in to comment.