Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions packages/configuration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class Configuration<T extends unknown> {

const cache = new Map<string, Configuration<unknown>>()

export function create<T extends unknown>(name: string, initialData?: T) {
const url = urlcat(`${DEFAULT_HOST}', ':prefix.:name.json`, {
export function create<T extends unknown>(name: string, prefix?: string, initialData?: T) {
const url = urlcat(DEFAULT_HOST, prefix ? ':prefix.:name.json' : ':name.json', {
name,
prefix: DEFAULT_PREFIX,
prefix: prefix ?? DEFAULT_PREFIX,
})
if (!cache.has(url)) cache.set(url, new Configuration(url, initialData))
return cache.get(url) as Configuration<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const useStyles = makeStyles()((theme) => ({
width: 36,
height: 36,
},
iframe: {
minWidth: 300,
minHeight: 300,
},
}))

export interface ArticleTabProps {}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-infra/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export namespace Plugin.SNSAdaptor {
/**
* If it returns false, this tab will not be displayed.
*/
shouldDisplay?: (identity?: ProfileIdentity, addressNames?: ProfileAddress[]) => boolean
shouldDisplay?(identity?: ProfileIdentity, addressNames?: ProfileAddress[]): boolean

/**
* Sort address name in expected order.
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/DAO/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@masknet/plugin-infra": "workspace:*",
"@masknet/shared": "workspace:*",
"@masknet/shared-base": "workspace:*",
"@masknet/configuration": "workspace:*",
"bignumber.js": "^9.0.2",
"date-fns": "^2.28.0",
"iframe-resizer-react": "^1.1.0",
Expand Down
32 changes: 29 additions & 3 deletions packages/plugins/DAO/src/SNSAdaptor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
import type { Plugin } from '@masknet/plugin-infra'
import { base } from '../base'
import { PLUGIN_ID, SUPPORTED_TWITTER_IDS } from '../constants'
import { PLUGIN_ID } from '../constants'
import { DAOPage } from '../components/DAOPage'
import { create } from '@masknet/configuration'

// cspell:disable
const DEFAULT_SUPPORTED_TWITTER_IDS = [
'ConstitutionDAO',
'juiceboxETH',
'AssangeDAO',
'OfficialMoonDAO',
'TheSpiceDAO',
'sharkdao',
'CrayonFinance',
'merge_dao',
'DAOTaiFung',
'Tile_DAO',
'mountaindao',
'OfficialMoonDAO',
]
// cspell:enable

const sns: Plugin.SNSAdaptor.Definition = {
...base,
Expand All @@ -17,10 +35,18 @@ const sns: Plugin.SNSAdaptor.Definition = {
},
},
Utils: {
shouldDisplay: (identity) => {
shouldDisplay: (identity, _addressNames) => {
const daoTabTwitterIdList = create(
'twitter-supported-id-list',
'',
DEFAULT_SUPPORTED_TWITTER_IDS,
).get()

return (
!identity?.identifier.isUnknown &&
SUPPORTED_TWITTER_IDS.some((x) => x.toLowerCase() === identity?.identifier.userId.toLowerCase())
(daoTabTwitterIdList ?? []).some(
(x) => x.toLowerCase() === identity?.identifier.userId.toLowerCase(),
)
)
},
},
Expand Down
17 changes: 0 additions & 17 deletions packages/plugins/DAO/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,3 @@ export const PLUGIN_ID = PluginId.DAO
export const PLUGIN_META_KEY = `${PluginId.DAO}:1`
export const PLUGIN_DESCRIPTION = 'The Web3 DAO based on JuiceBox.'
export const PLUGIN_NAME = 'DAO'

// cspell:disable
export const SUPPORTED_TWITTER_IDS = [
'ConstitutionDAO',
'juiceboxETH',
'AssangeDAO',
'OfficialMoonDAO',
'TheSpiceDAO',
'sharkdao',
'CrayonFinance',
'merge_dao',
'DAOTaiFung',
'Tile_DAO',
'mountaindao',
'OfficialMoonDAO',
]
// cspell:enable
3 changes: 2 additions & 1 deletion packages/plugins/DAO/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{ "path": "../../shared" },
{ "path": "../../shared-base" },
{ "path": "../../theme" },
{ "path": "../../web3-providers" }
{ "path": "../../web3-providers" },
{ "path": "../../configuration" }
]
}
6 changes: 6 additions & 0 deletions packages/shared/src/UI/components/AssetPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ export const AssetPlayer = memo<AssetPlayerProps>((props) => {
}
}, [playerState, ref.current])

useEffect(() => {
if (playerState === AssetPlayerState.NORMAL) {
ref.current?.iFrameResizer.sendMessage({ loaded: true })
}
}, [playerState, ref.current])

const IframeResizerMemo = useMemo(
() =>
hidden ? null : (
Expand Down
8 changes: 5 additions & 3 deletions pnpm-lock.yaml

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