Skip to content

Commit

Permalink
Update Grill widget
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmell committed Mar 11, 2024
1 parent 2227b66 commit c3462bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@polkawallet/bridge": "0.1.3",
"@reduxjs/toolkit": "^1.6.2",
"@subsocial/api": "0.8.13",
"@subsocial/grill-widget": "^0.0.13",
"@subsocial/grill-widget": "^0.1.3",
"@subsocial/resource-discussions": "0.0.4",
"@subsocial/utils": "0.8.13",
"@zeit/next-css": "^1.0.1",
Expand Down
30 changes: 5 additions & 25 deletions src/components/chat/ChatIframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@ import { ComponentProps, useEffect, useState } from 'react'
import grill, { GrillConfig, GrillEventListener } from '@subsocial/grill-widget'
import { useSendEvent } from '../providers/AnalyticContext'
import useWrapInRef from '../../hooks/useWrapInRef'
import { Resource } from '@subsocial/resource-discussions'
import {
ChanelTypeChannel,
ChanelTypeResource,
GenerateGrillConfigParams,
} from './types'
import { useChatContext } from '../providers/ChatContext'
import { isCreatorStakingPage } from '../utils'
import { useRouter } from 'next/router'
import { getCurrentWallet } from '../utils'

const creatorsHubId = '1218'

function generateGrillConfig ({
hubId = 'polka',
hubId = 'featured',
spaceId,
metadata,
}: GenerateGrillConfigParams): GrillConfig {
const settings = {
enableInputAutofocus: true,
Expand All @@ -29,27 +24,12 @@ function generateGrillConfig ({

const isCreatorStaking = isCreatorStakingPage()

// TODO: remove this hack and improve the config for using hub instead of channel
const hub = isCreatorStaking || spaceId ? { id: creatorsHubId } : { id: hubId }
const hub = { id: hubId }

const channel = spaceId
? ({
type: 'resource',
resource: new Resource({
schema: 'chain',
chainType: 'substrate',
chainName: 'subsocial',
resourceType: 'creator',
resourceValue: {
id: spaceId,
},
}),
metadata: metadata,
} as ChanelTypeResource)
: ({
const channel = {
type: 'channel',
id: '754',
} as ChanelTypeChannel)
id: '54461',
} as ChanelTypeChannel

return {
hub,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5343,10 +5343,10 @@
"@polkadot/api" latest
lodash.camelcase "^4.3.0"

"@subsocial/grill-widget@^0.0.13":
version "0.0.13"
resolved "https://registry.yarnpkg.com/@subsocial/grill-widget/-/grill-widget-0.0.13.tgz#b3001beb2c5eef140f36befff00a581892f7547f"
integrity sha512-16t1zgWC0nFP/iqhlYEVkRL+kzSqBfjTS2xhCPMNTzb51MjpVpGgZLTd77Jq3NU/iqnplyH690iKGzQIixHFkw==
"@subsocial/grill-widget@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@subsocial/grill-widget/-/grill-widget-0.1.3.tgz#8496d5761b686d6d846b4832b6cbce6c32f19809"
integrity sha512-t7J2wd10qaEPWsgP5v4ZP2DpC/WjaR1Cl59ee6VkGUWEUvjR2JcAJbjtUtzKsEvqpo1cXOXixqqU06FUHpLyRg==

"@subsocial/resource-discussions@0.0.4":
version "0.0.4"
Expand Down

0 comments on commit c3462bf

Please sign in to comment.