Browse Source

Update 'dev' from 'master' (#4039)

* 🏳️  Nft carousel (#3959)

* Replace old package with glide

* Fix video form format issue (#4022)

* Fix nft carousel, fix the issue with not setting the app id (#4024)

* fix issue with not setting app id

* fix nft carousel

* fix cache error

* 🎪 Fix showing all videos in category (#4023)

* Remove unused config entries

* Fix videos in category

* 📗 Correct pagination button styles (#4001)

* Correct pagination button styles

* 🧓 Update form components (#4006)

* updated styling of Input, Select, OptionCard

* Show carousel only if there are 6 verified channels (#4028)

* show carousel only if there are 6 verified channels

* Fix my videos loading time (#4029)

* 🥨 Channel creation progression (#4000)

* Progress drawer styles

* Channel creation view fixes

* Channel bug fix (#4032)

* Don't show user's channels in referrer input (#4035)

* Fix issue with not being able to create a channel (#4037)

* fix issue with not being able to create a channel

* fix issue with undefined value

---------

Co-authored-by: Artem <Artem Slugin>
Co-authored-by: WRadoslaw <92513933+WRadoslaw@users.noreply.github.com>
Co-authored-by: Bartosz Dryl <drylbartosz@gmail.com>
attemka 1 year ago
parent
commit
f01da07db7

+ 3 - 3
packages/atlas/src/api/hooks/apps.ts

@@ -20,8 +20,8 @@ export const useAppActionMetadataProcessor = (
 
   return useCallback(
     async (rawMetadataU8a: Uint8Array, assetsU8a: Uint8Array) => {
-      if (!channelId || !memberId) {
-        throw Error("channelId or memberId wasn't provided")
+      if (!memberId) {
+        throw Error("MemberId wasn't provided")
       }
       const { data } = await getTotalChannelsAndTotalVideos({
         variables: {
@@ -32,7 +32,7 @@ export const useAppActionMetadataProcessor = (
       })
       const nonce =
         (actionType === AppActionActionType.CreateVideo
-          ? data?.membershipById?.channels[0].totalVideosCreated
+          ? data?.membershipById?.channels[0]?.totalVideosCreated
           : data?.membershipById?.totalChannelsCreated) || 0
 
       if (atlasConfig.general.appId) {

+ 2 - 1
packages/atlas/src/api/hooks/channel.ts

@@ -37,7 +37,8 @@ export const useBasicChannel = (
   const { data, ...rest } = useGetExtendedBasicChannelsQuery({
     ...opts,
     variables: {
-      where: { channel: { id_eq: id } },
+      ...opts?.variables,
+      where: { ...opts?.variables?.where, channel: { ...opts?.variables?.where?.channel, id_eq: id } },
     },
   })
   return {

+ 18 - 7
packages/atlas/src/components/_ypp/YppReferralBanner/YppReferralBanner.tsx

@@ -10,6 +10,7 @@ import { atlasConfig } from '@/config'
 import { QUERY_PARAMS, absoluteRoutes } from '@/config/routes'
 import { useMediaMatch } from '@/hooks/useMediaMatch'
 import { useRouterQuery } from '@/hooks/useRouterQuery'
+import { useUser } from '@/providers/user/user.hooks'
 import { useYppStore } from '@/providers/ypp/ypp.store'
 import { cVar, transitions } from '@/styles'
 
@@ -30,24 +31,34 @@ type YppReferralBannerProps = {
 const appName = atlasConfig.general.appName
 export const YppReferralBanner: FC<YppReferralBannerProps> = ({ className }) => {
   const xsMatch = useMediaMatch('xs')
+  const { memberId } = useUser()
 
   const queryReferrerId = useRouterQuery(QUERY_PARAMS.REFERRER_ID)
   const setReferrerId = useYppStore((state) => state.actions.setReferrerId)
-  // persist referrer id in store
-  useEffect(() => {
-    if (queryReferrerId) {
-      setReferrerId(queryReferrerId)
-    }
-  }, [queryReferrerId, setReferrerId])
 
   const storeReferrerId = useYppStore((state) => state.referrerId)
   const referrerId = queryReferrerId || storeReferrerId
   const { loading: isLoadingChannel, extendedChannel } = useBasicChannel(referrerId || '', {
+    variables: {
+      where: {
+        channel: {
+          ownerMember: {
+            id_not_eq: memberId || '',
+          },
+        },
+      },
+    },
     skip: !referrerId,
   })
+
   const channel = extendedChannel?.channel
   const channelAvatarUrl = channel?.avatarPhoto?.resolvedUrl
-  const shouldShowReferrerBanner = referrerId && (isLoadingChannel || channel)
+  const shouldShowReferrerBanner = referrerId && channel && !isLoadingChannel
+
+  // persist referrer id in store
+  useEffect(() => {
+    setReferrerId(channel ? channel.id : null)
+  }, [channel, setReferrerId])
 
   const isLoading = isLoadingChannel
 

+ 3 - 3
packages/atlas/src/views/global/YppLandingView/YppAuthorizationModal/YppAuthorizationSteps/YppAuthorizationDetailsFormStep/YppAuthorizationDetailsFormStep.tsx

@@ -72,9 +72,6 @@ export const YppAuthorizationDetailsFormStep: FC = () => {
             if (value && !foundChannel) {
               return 'No channel with this title has been found.'
             }
-            if (foundChannel?.ownerMember?.id === memberId) {
-              return 'Your own channel is not a valid referrer.'
-            }
             return true
           },
         }}
@@ -95,6 +92,9 @@ export const YppAuthorizationDetailsFormStep: FC = () => {
                 where: {
                   channel: {
                     title_startsWith: value,
+                    ownerMember: {
+                      id_not_eq: memberId,
+                    },
                   },
                 },
               })}