feat: support change media upload service
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Label } from '@/components/ui/label'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue
|
||||
} from '@/components/ui/select'
|
||||
import { DEFAULT_NIP_96_SERVICE, NIP_96_SERVICE } from '@/constants'
|
||||
import { simplifyUrl } from '@/lib/url'
|
||||
import { useMediaUploadService } from '@/providers/MediaUploadServiceProvider'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function MediaUploadServiceSetting() {
|
||||
const { t } = useTranslation()
|
||||
const { service, updateService } = useMediaUploadService()
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="media-upload-service-select">{t('Media upload service')}</Label>
|
||||
<Select defaultValue={DEFAULT_NIP_96_SERVICE} value={service} onValueChange={updateService}>
|
||||
<SelectTrigger id="media-upload-service-select" className="w-48">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{NIP_96_SERVICE.map((url) => (
|
||||
<SelectItem key={url} value={url}>
|
||||
{simplifyUrl(url)}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
18
src/pages/secondary/PostSettingsPage/index.tsx
Normal file
18
src/pages/secondary/PostSettingsPage/index.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { forwardRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import MediaUploadServiceSetting from './MediaUploadServiceSetting'
|
||||
|
||||
const PostSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<SecondaryPageLayout ref={ref} index={index} title={t('Wallet')}>
|
||||
<div className="px-4 pt-2 space-y-4">
|
||||
<MediaUploadServiceSetting />
|
||||
</div>
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
})
|
||||
PostSettingsPage.displayName = 'PostSettingsPage'
|
||||
export default PostSettingsPage
|
||||
@@ -3,7 +3,7 @@ import Donation from '@/components/Donation'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger } from '@/components/ui/select'
|
||||
import { LocalizedLanguageNames, TLanguage } from '@/i18n'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { toRelaySettings, toWallet } from '@/lib/link'
|
||||
import { toPostSettings, toRelaySettings, toWallet } from '@/lib/link'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useSecondaryPage } from '@/PageManager'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
Info,
|
||||
KeyRound,
|
||||
Languages,
|
||||
PencilLine,
|
||||
Server,
|
||||
SunMoon,
|
||||
Wallet
|
||||
@@ -87,6 +88,13 @@ const SettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
<SettingItem className="clickable" onClick={() => push(toPostSettings())}>
|
||||
<div className="flex items-center gap-4">
|
||||
<PencilLine />
|
||||
<div>{t('Posts')}</div>
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
{!!nsec && (
|
||||
<SettingItem
|
||||
className="clickable"
|
||||
|
||||
Reference in New Issue
Block a user