forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## About The Pull Request Добавляет ТГУИ-шку в панель Admin под названием Ru Names Suggestions, где можно посмотреть на имеющиеся предложения переводов от игроков. Аппрувнутые предложения уходят в дискорд через вебхук, денай уходит в небытие (оба логируются). Предложение игрока отправляется в `data/ru_names_suggest.json`. Также делает более красивым меню предложения перевода. ![image](https://github.com/user-attachments/assets/f1a8e699-214b-4685-bc3d-5fe991dcf7ce) ![image](https://github.com/user-attachments/assets/a0f6db3c-fcf0-46cb-b549-df121889f2e2) ![image](https://github.com/user-attachments/assets/a64cf65f-0849-45b8-8fec-474ae83142a1) # ДЛЯ ХОСТА Не забудь проверить существование файла `data/ru_names_suggest.json` Не забудь выставить в конфиге `config/bandastation/bandastation_config.txt` вебхук --------- Co-authored-by: Aylong <[email protected]>
- Loading branch information
Showing
4 changed files
with
356 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { Button, Collapsible, LabeledList, Stack } from 'tgui-core/components'; | ||
|
||
import { useBackend } from '../backend'; | ||
import { Window } from '../layouts'; | ||
|
||
export const RuNamesReviewPanel = (props) => { | ||
const { act, data } = useBackend(); | ||
const json_data = data.json_data || []; | ||
return ( | ||
<Window | ||
title="Предложения переводов" | ||
theme="admin" | ||
width={550} | ||
height={400} | ||
> | ||
<Window.Content scrollable> | ||
{json_data.map((entry_id) => ( | ||
<Collapsible | ||
key={entry_id} | ||
title={entry_id.ckey + ' предлагает для ' + entry_id.atom_path} | ||
> | ||
<LabeledList> | ||
<LabeledList.Item label="ckey">{entry_id.ckey}</LabeledList.Item> | ||
<LabeledList.Item label="Путь к объекту"> | ||
{entry_id.atom_path} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Стандартное имя"> | ||
{entry_id.suggested_list['base']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Именительный"> | ||
{entry_id.suggested_list['именительный']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Родительный"> | ||
{entry_id.suggested_list['родительный']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Дательный"> | ||
{entry_id.suggested_list['дательный']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Винительный"> | ||
{entry_id.suggested_list['винительный']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Творительный"> | ||
{entry_id.suggested_list['творительный']} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Предложный"> | ||
{entry_id.suggested_list['предложный']} | ||
</LabeledList.Item> | ||
</LabeledList> | ||
<Stack mt={0.75}> | ||
<Stack.Item grow> | ||
<Button.Confirm | ||
fluid | ||
confirmContent="Вы уверены?" | ||
color="green" | ||
onClick={() => | ||
act('approve', { | ||
entry_id: entry_id.ckey + '-' + entry_id.atom_path, | ||
}) | ||
} | ||
> | ||
Принять | ||
</Button.Confirm> | ||
</Stack.Item> | ||
<Stack.Item grow> | ||
<Button.Confirm | ||
fluid | ||
confirmContent="Вы уверены?" | ||
color="red" | ||
onClick={() => | ||
act('deny', { | ||
entry_id: entry_id.ckey + '-' + entry_id.atom_path, | ||
}) | ||
} | ||
> | ||
Отклонить | ||
</Button.Confirm> | ||
</Stack.Item> | ||
</Stack> | ||
</Collapsible> | ||
))} | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { useState } from 'react'; | ||
import { Button, Input, LabeledList, Section } from 'tgui-core/components'; | ||
|
||
import { useBackend } from '../backend'; | ||
import { Window } from '../layouts'; | ||
|
||
export const RuNamesSuggestPanel = (props) => { | ||
const { act, data } = useBackend(); | ||
const visible_name = data.visible_name; | ||
const [nominative, setNominative] = useState(''); | ||
const [genitive, setGenitive] = useState(''); | ||
const [dative, setDative] = useState(''); | ||
const [accusative, setAccusative] = useState(''); | ||
const [instrumental, setInstrumental] = useState(''); | ||
const [prepositional, setPrepositional] = useState(''); | ||
return ( | ||
<Window theme="admin" title="Предложение перевода" width={450} height={250}> | ||
<Window.Content /> | ||
<Section title={'Оригинал: ' + visible_name}> | ||
<LabeledList> | ||
<LabeledList.Item label="Именительный (Кто? Что?)"> | ||
<Input width="100%" onChange={(e, value) => setNominative(value)} /> | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Родительный (Кого? Чего?)"> | ||
<Input width="100%" onChange={(e, value) => setGenitive(value)} /> | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Дательный (Кому? Чему?)"> | ||
<Input width="100%" onChange={(e, value) => setDative(value)} /> | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Винительный (Кого? Что?)"> | ||
<Input width="100%" onChange={(e, value) => setAccusative(value)} /> | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Творительный (Кем? Чем?)"> | ||
<Input | ||
width="100%" | ||
onChange={(e, value) => setInstrumental(value)} | ||
/> | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Предложный (О/В ком/чём?)"> | ||
<Input | ||
width="100%" | ||
onChange={(e, value) => setPrepositional(value)} | ||
/> | ||
</LabeledList.Item> | ||
</LabeledList> | ||
<Button.Confirm | ||
fluid | ||
textAlign="center" | ||
mt={1.5} | ||
confirmColor="green" | ||
confirmContent="Вы уверены?" | ||
disabled={ | ||
!nominative || | ||
!genitive || | ||
!dative || | ||
!accusative || | ||
!instrumental || | ||
!prepositional | ||
} | ||
onClick={() => | ||
act('send', { | ||
entries: [ | ||
nominative, | ||
genitive, | ||
dative, | ||
accusative, | ||
instrumental, | ||
prepositional, | ||
], | ||
}) | ||
} | ||
> | ||
Отправить | ||
</Button.Confirm> | ||
</Section> | ||
</Window> | ||
); | ||
}; |