Sfoglia il codice sorgente

Feat: add search params with theme in links of marketplace (#19648)

tags/1.4.0
KVOJJJin 5 mesi fa
parent
commit
2c5f5b0c67
Nessun account collegato all'indirizzo email del committer

+ 3
- 1
web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx Vedi File

import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import Link from 'next/link' import Link from 'next/link'
import { import {
searchText, searchText,
}: InstallFromMarketplaceProps) => { }: InstallFromMarketplaceProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const [collapse, setCollapse] = useState(false) const [collapse, setCollapse] = useState(false)
const locale = getLocaleOnClient() const locale = getLocaleOnClient()
const { const {
</div> </div>
<div className='mb-2 flex items-center pt-2'> <div className='mb-2 flex items-center pt-2'>
<span className='system-sm-regular pr-1 text-text-tertiary'>{t('common.modelProvider.discoverMore')}</span> <span className='system-sm-regular pr-1 text-text-tertiary'>{t('common.modelProvider.discoverMore')}</span>
<Link target="_blank" href={`${MARKETPLACE_URL_PREFIX}`} className='system-sm-medium inline-flex items-center text-text-accent'>
<Link target="_blank" href={`${MARKETPLACE_URL_PREFIX}${theme ? `?theme=${theme}` : ''}`} className='system-sm-medium inline-flex items-center text-text-accent'>
{t('plugin.marketplace.difyMarketplace')} {t('plugin.marketplace.difyMarketplace')}
<RiArrowRightUpLine className='h-4 w-4' /> <RiArrowRightUpLine className='h-4 w-4' />
</Link> </Link>

+ 3
- 1
web/app/components/plugins/marketplace/list/card-wrapper.tsx Vedi File

'use client' 'use client'
import { useTheme } from 'next-themes'
import { RiArrowRightUpLine } from '@remixicon/react' import { RiArrowRightUpLine } from '@remixicon/react'
import { getPluginLinkInMarketplace } from '../utils' import { getPluginLinkInMarketplace } from '../utils'
import Card from '@/app/components/plugins/card' import Card from '@/app/components/plugins/card'
locale, locale,
}: CardWrapperProps) => { }: CardWrapperProps) => {
const { t } = useMixedTranslation(locale) const { t } = useMixedTranslation(locale)
const { theme } = useTheme()
const [isShowInstallFromMarketplace, { const [isShowInstallFromMarketplace, {
setTrue: showInstallFromMarketplace, setTrue: showInstallFromMarketplace,
setFalse: hideInstallFromMarketplace, setFalse: hideInstallFromMarketplace,
> >
{t('plugin.detailPanel.operation.install')} {t('plugin.detailPanel.operation.install')}
</Button> </Button>
<a href={`${getPluginLinkInMarketplace(plugin)}?language=${localeFromLocale}`} target='_blank' className='block w-[calc(50%-4px)] flex-1 shrink-0'>
<a href={`${getPluginLinkInMarketplace(plugin)}?language=${localeFromLocale}${theme ? `&theme=${theme}` : ''}`} target='_blank' className='block w-[calc(50%-4px)] flex-1 shrink-0'>
<Button <Button
className='w-full gap-0.5' className='w-full gap-0.5'
> >

+ 4
- 2
web/app/components/plugins/plugin-detail-panel/detail-header.tsx Vedi File

import React, { useCallback, useMemo, useState } from 'react' import React, { useCallback, useMemo, useState } from 'react'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useBoolean } from 'ahooks' import { useBoolean } from 'ahooks'
import { import {
onUpdate, onUpdate,
}: Props) => { }: Props) => {
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const locale = useGetLanguage() const locale = useGetLanguage()
const { checkForUpdates, fetchReleases } = useGitHubReleases() const { checkForUpdates, fetchReleases } = useGitHubReleases()
const { setShowUpdatePluginModal } = useModalContext() const { setShowUpdatePluginModal } = useModalContext()
if (isFromGitHub) if (isFromGitHub)
return `https://github.com/${meta!.repo}` return `https://github.com/${meta!.repo}`
if (isFromMarketplace) if (isFromMarketplace)
return `${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}`
return `${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}${theme ? `?theme=${theme}` : ''}`
return '' return ''
}, [author, isFromGitHub, isFromMarketplace, meta, name])
}, [author, isFromGitHub, isFromMarketplace, meta, name, theme])


const [isShowUpdateModal, { const [isShowUpdateModal, {
setTrue: showUpdateModal, setTrue: showUpdateModal,

+ 3
- 1
web/app/components/plugins/plugin-item/index.tsx Vedi File

'use client' 'use client'
import type { FC } from 'react' import type { FC } from 'react'
import React, { useMemo } from 'react' import React, { useMemo } from 'react'
import { useTheme } from 'next-themes'
import { import {
RiArrowRightUpLine, RiArrowRightUpLine,
RiBugLine, RiBugLine,
plugin, plugin,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const { categoriesMap } = useSingleCategories() const { categoriesMap } = useSingleCategories()
const currentPluginID = usePluginPageContext(v => v.currentPluginID) const currentPluginID = usePluginPageContext(v => v.currentPluginID)
const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID) const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID)
} }
{source === PluginSource.marketplace {source === PluginSource.marketplace
&& <> && <>
<a href={`${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}`} target='_blank' className='flex items-center gap-0.5'>
<a href={`${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}${theme ? `?theme=${theme}` : ''}`} target='_blank' className='flex items-center gap-0.5'>
<div className='system-2xs-medium-uppercase text-text-tertiary'>{t('plugin.from')} <span className='text-text-secondary'>marketplace</span></div> <div className='system-2xs-medium-uppercase text-text-tertiary'>{t('plugin.from')} <span className='text-text-secondary'>marketplace</span></div>
<RiArrowRightUpLine className='h-3 w-3 text-text-tertiary' /> <RiArrowRightUpLine className='h-3 w-3 text-text-tertiary' />
</a> </a>

+ 3
- 1
web/app/components/plugins/provider-card.tsx Vedi File

'use client' 'use client'
import React from 'react' import React from 'react'
import type { FC } from 'react' import type { FC } from 'react'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { RiArrowRightUpLine } from '@remixicon/react' import { RiArrowRightUpLine } from '@remixicon/react'
import Badge from '../base/badge' import Badge from '../base/badge'
}) => { }) => {
const getValueFromI18nObject = useRenderI18nObject() const getValueFromI18nObject = useRenderI18nObject()
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const [isShowInstallFromMarketplace, { const [isShowInstallFromMarketplace, {
setTrue: showInstallFromMarketplace, setTrue: showInstallFromMarketplace,
setFalse: hideInstallFromMarketplace, setFalse: hideInstallFromMarketplace,
className='grow' className='grow'
variant='secondary' variant='secondary'
> >
<a href={`${getPluginLinkInMarketplace(payload)}?language=${locale}`} target='_blank' className='flex items-center gap-0.5'>
<a href={`${getPluginLinkInMarketplace(payload)}?language=${locale}${theme ? `&theme=${theme}` : ''}`} target='_blank' className='flex items-center gap-0.5'>
{t('plugin.detailPanel.operation.detail')} {t('plugin.detailPanel.operation.detail')}
<RiArrowRightUpLine className='h-4 w-4' /> <RiArrowRightUpLine className='h-4 w-4' />
</a> </a>

+ 3
- 2
web/app/components/tools/marketplace/index.tsx Vedi File

useEffect, useEffect,
useRef, useRef,
} from 'react' } from 'react'
import { useTheme } from 'next-themes'
import { import {
RiArrowRightUpLine, RiArrowRightUpLine,
RiArrowUpDoubleLine, RiArrowUpDoubleLine,
}: MarketplaceProps) => { }: MarketplaceProps) => {
const locale = getLocaleOnClient() const locale = getLocaleOnClient()
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const { const {
isLoading, isLoading,
marketplaceCollections, marketplaceCollections,
</span> </span>
{t('common.operation.in')} {t('common.operation.in')}
<a <a
href={`${MARKETPLACE_URL_PREFIX}?language=${locale}&q=${searchPluginText}&tags=${filterPluginTags.join(',')}`}
href={`${MARKETPLACE_URL_PREFIX}?language=${locale}&q=${searchPluginText}&tags=${filterPluginTags.join(',')}${theme ? `&theme=${theme}` : ''}`}
className='system-sm-medium ml-1 flex items-center text-text-accent' className='system-sm-medium ml-1 flex items-center text-text-accent'
target='_blank' target='_blank'
> >

+ 3
- 1
web/app/components/workflow/block-selector/market-place-plugin/action.tsx Vedi File

'use client' 'use client'
import type { FC } from 'react' import type { FC } from 'react'
import React, { useCallback, useEffect, useRef, useState } from 'react' import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { RiMoreFill } from '@remixicon/react' import { RiMoreFill } from '@remixicon/react'
import ActionButton from '@/app/components/base/action-button' import ActionButton from '@/app/components/base/action-button'
version, version,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { theme } = useTheme()
const openRef = useRef(open) const openRef = useRef(open)
const setOpen = useCallback((v: boolean) => { const setOpen = useCallback((v: boolean) => {
onOpenChange(v) onOpenChange(v)
<PortalToFollowElemContent className='z-[9999]'> <PortalToFollowElemContent className='z-[9999]'>
<div className='w-[112px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg'> <div className='w-[112px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg'>
<div onClick={handleDownload} className='system-md-regular cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover'>{t('common.operation.download')}</div> <div onClick={handleDownload} className='system-md-regular cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover'>{t('common.operation.download')}</div>
<a href={`${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}`} target='_blank' className='system-md-regular block cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover'>{t('common.operation.viewDetails')}</a>
<a href={`${MARKETPLACE_URL_PREFIX}/plugins/${author}/${name}${theme ? `?theme=${theme}` : ''}`} target='_blank' className='system-md-regular block cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover'>{t('common.operation.viewDetails')}</a>
</div> </div>
</PortalToFollowElemContent> </PortalToFollowElemContent>
</PortalToFollowElem> </PortalToFollowElem>

Loading…
Annulla
Salva