X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fcommon%2FDiscordSelect.js;fp=resources%2Fjs%2Fcomponents%2Fcommon%2FDiscordSelect.js;h=65c94d63cab503893137052ec61d1ccf20456f0c;hb=b45c183b7ba39080b6438c6238bad614c4d3953e;hp=a279cdef83a332668ad6bed14c512cd3deb9c025;hpb=16662be0b3432d67307ae8c2bb798362d77bab99;p=alttp.git diff --git a/resources/js/components/common/DiscordSelect.js b/resources/js/components/common/DiscordSelect.js index a279cde..65c94d6 100644 --- a/resources/js/components/common/DiscordSelect.js +++ b/resources/js/components/common/DiscordSelect.js @@ -1,8 +1,10 @@ import axios from 'axios'; import PropTypes from 'prop-types'; import React, { useCallback, useEffect, useRef, useState } from 'react'; -import { Form, ListGroup } from 'react-bootstrap'; +import { Alert, Button, Form, ListGroup } from 'react-bootstrap'; +import { useTranslation } from 'react-i18next'; +import Icon from './Icon'; import GuildBox from '../discord-guilds/Box'; import debounce from '../../helpers/debounce'; @@ -13,6 +15,7 @@ const DiscordSelect = ({ onChange, value }) => { const [showResults, setShowResults] = useState(false); const ref = useRef(null); + const { t } = useTranslation(); useEffect(() => { const handleEventOutside = e => { @@ -66,7 +69,17 @@ const DiscordSelect = ({ onChange, value }) => { }, [value]); if (value) { - return
{resolved ? : value}
; + return
+ {resolved ? : value} + +
; } return
{ value={search} />
- - {results.map(result => - onChange({ target: { value: result.guild_id }})} - > - - - )} - + {results.length ? + + {results.map(result => + onChange({ + guild: result, + target: { value: result.guild_id }, + })} + > + + + )} + + : + + {t('search.noResults')} + + }
; };