categories,18popup,clear.TextEditorSwap,GameCardHover #177
@ -8,13 +8,13 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
useState
|
useState
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useLocation, useNavigate } from 'react-router-dom'
|
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import { FixedSizeList as List } from 'react-window'
|
import { FixedSizeList as List } from 'react-window'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { T_TAG_VALUE } from '../constants'
|
import { T_TAG_VALUE } from '../constants'
|
||||||
import { useAppSelector, useGames, useNDKContext } from '../hooks'
|
import { useAppSelector, useGames, useNDKContext } from '../hooks'
|
||||||
import { appRoutes, getModPageRoute } from '../routes'
|
import { appRoutes, getGamePageRoute, getModPageRoute } from '../routes'
|
||||||
import '../styles/styles.css'
|
import '../styles/styles.css'
|
||||||
import { Categories, DownloadUrl, ModDetails, ModFormState } from '../types'
|
import { Categories, DownloadUrl, ModDetails, ModFormState } from '../types'
|
||||||
import {
|
import {
|
||||||
@ -256,6 +256,9 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
|||||||
tags
|
tags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(unsignedEvent)
|
||||||
|
return
|
||||||
|
|
||||||
const signedEvent = await window.nostr
|
const signedEvent = await window.nostr
|
||||||
?.signEvent(unsignedEvent)
|
?.signEvent(unsignedEvent)
|
||||||
.then((event) => event as Event)
|
.then((event) => event as Event)
|
||||||
@ -507,6 +510,7 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
|||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
/>
|
/>
|
||||||
<CategoryAutocomplete
|
<CategoryAutocomplete
|
||||||
|
game={formState.game}
|
||||||
lTags={formState.lTags}
|
lTags={formState.lTags}
|
||||||
LTags={formState.LTags}
|
LTags={formState.LTags}
|
||||||
setFormState={setFormState}
|
setFormState={setFormState}
|
||||||
@ -901,12 +905,14 @@ const GameDropdown = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CategoryAutocompleteProps {
|
interface CategoryAutocompleteProps {
|
||||||
|
game: string
|
||||||
lTags: string[]
|
lTags: string[]
|
||||||
LTags: string[]
|
LTags: string[]
|
||||||
setFormState: (value: React.SetStateAction<ModFormState>) => void
|
setFormState: (value: React.SetStateAction<ModFormState>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CategoryAutocomplete = ({
|
export const CategoryAutocomplete = ({
|
||||||
|
game,
|
||||||
lTags,
|
lTags,
|
||||||
LTags,
|
LTags,
|
||||||
setFormState
|
setFormState
|
||||||
@ -970,10 +976,11 @@ export const CategoryAutocomplete = ({
|
|||||||
}
|
}
|
||||||
const handleAddNew = () => {
|
const handleAddNew = () => {
|
||||||
if (inputValue) {
|
if (inputValue) {
|
||||||
|
const value = inputValue.trim()
|
||||||
const newOption: Categories = {
|
const newOption: Categories = {
|
||||||
name: inputValue,
|
name: value,
|
||||||
hierarchy: inputValue,
|
hierarchy: value,
|
||||||
l: [inputValue]
|
l: value.split('>').map((s) => s.trim())
|
||||||
}
|
}
|
||||||
setSelectedCategories([...selectedCategories, newOption])
|
setSelectedCategories([...selectedCategories, newOption])
|
||||||
setInputValue('')
|
setInputValue('')
|
||||||
@ -1100,9 +1107,15 @@ export const CategoryAutocomplete = ({
|
|||||||
const heirarchicalCategories = hierarchy.split(`:`)
|
const heirarchicalCategories = hierarchy.split(`:`)
|
||||||
const categories = heirarchicalCategories
|
const categories = heirarchicalCategories
|
||||||
.map<React.ReactNode>((c: string) => (
|
.map<React.ReactNode>((c: string) => (
|
||||||
<a className='IBMSMSMBSSCategoriesBoxItem'>
|
<Link
|
||||||
|
to={{
|
||||||
|
pathname: getGamePageRoute(game),
|
||||||
|
search: `c=${c}`
|
||||||
|
}}
|
||||||
|
className='IBMSMSMBSSCategoriesBoxItem'
|
||||||
|
>
|
||||||
<p>{capitalizeEachWord(c)}</p>
|
<p>{capitalizeEachWord(c)}</p>
|
||||||
</a>
|
</Link>
|
||||||
))
|
))
|
||||||
.reduce((prev, curr) => [
|
.reduce((prev, curr) => [
|
||||||
prev,
|
prev,
|
||||||
|
@ -28,6 +28,7 @@ import '../../styles/tags.css'
|
|||||||
import '../../styles/write.css'
|
import '../../styles/write.css'
|
||||||
import { DownloadUrl, ModPageLoaderResult } from '../../types'
|
import { DownloadUrl, ModPageLoaderResult } from '../../types'
|
||||||
import {
|
import {
|
||||||
|
capitalizeEachWord,
|
||||||
copyTextToClipboard,
|
copyTextToClipboard,
|
||||||
downloadFile,
|
downloadFile,
|
||||||
getFilenameFromUrl
|
getFilenameFromUrl
|
||||||
@ -103,10 +104,10 @@ export const ModPage = () => {
|
|||||||
featuredImageUrl={mod.featuredImageUrl}
|
featuredImageUrl={mod.featuredImageUrl}
|
||||||
title={mod.title}
|
title={mod.title}
|
||||||
body={mod.body}
|
body={mod.body}
|
||||||
|
game={mod.game}
|
||||||
screenshotsUrls={mod.screenshotsUrls}
|
screenshotsUrls={mod.screenshotsUrls}
|
||||||
tags={mod.tags}
|
tags={mod.tags}
|
||||||
LTags={mod.LTags}
|
LTags={mod.LTags}
|
||||||
lTags={mod.lTags}
|
|
||||||
nsfw={mod.nsfw}
|
nsfw={mod.nsfw}
|
||||||
repost={mod.repost}
|
repost={mod.repost}
|
||||||
originalAuthor={mod.originalAuthor}
|
originalAuthor={mod.originalAuthor}
|
||||||
@ -426,10 +427,10 @@ type BodyProps = {
|
|||||||
featuredImageUrl: string
|
featuredImageUrl: string
|
||||||
title: string
|
title: string
|
||||||
body: string
|
body: string
|
||||||
|
game: string
|
||||||
screenshotsUrls: string[]
|
screenshotsUrls: string[]
|
||||||
tags: string[]
|
tags: string[]
|
||||||
LTags: string[]
|
LTags: string[]
|
||||||
lTags: string[]
|
|
||||||
nsfw: boolean
|
nsfw: boolean
|
||||||
repost: boolean
|
repost: boolean
|
||||||
originalAuthor?: string
|
originalAuthor?: string
|
||||||
@ -437,12 +438,12 @@ type BodyProps = {
|
|||||||
|
|
||||||
const Body = ({
|
const Body = ({
|
||||||
featuredImageUrl,
|
featuredImageUrl,
|
||||||
|
game,
|
||||||
title,
|
title,
|
||||||
body,
|
body,
|
||||||
screenshotsUrls,
|
screenshotsUrls,
|
||||||
tags,
|
tags,
|
||||||
LTags,
|
LTags,
|
||||||
lTags,
|
|
||||||
nsfw,
|
nsfw,
|
||||||
repost,
|
repost,
|
||||||
originalAuthor
|
originalAuthor
|
||||||
@ -545,9 +546,15 @@ const Body = ({
|
|||||||
const heirarchicalCategories = hierarchy.split(`:`)
|
const heirarchicalCategories = hierarchy.split(`:`)
|
||||||
const categories = heirarchicalCategories
|
const categories = heirarchicalCategories
|
||||||
.map<React.ReactNode>((c: string) => (
|
.map<React.ReactNode>((c: string) => (
|
||||||
<a className='IBMSMSMBSSCategoriesBoxItem'>
|
<ReactRouterLink
|
||||||
<p>{c}</p>
|
className='IBMSMSMBSSCategoriesBoxItem'
|
||||||
</a>
|
to={{
|
||||||
|
pathname: getGamePageRoute(game),
|
||||||
|
search: `c=${c}`
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<p>{capitalizeEachWord(c)}</p>
|
||||||
|
</ReactRouterLink>
|
||||||
))
|
))
|
||||||
.reduce((prev, curr) => [
|
.reduce((prev, curr) => [
|
||||||
prev,
|
prev,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user