Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
w3labkr committed Sep 5, 2022
2 parents 06e6831 + 39d155e commit 749ce3a
Show file tree
Hide file tree
Showing 30 changed files with 539 additions and 329 deletions.
31 changes: 19 additions & 12 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@
"Start text": "Start text",
"End text": "End text",
"Random Text": "Random Text",
"Length of random text generated:": "Length of random text generated:",
"Enter the stopwords to be removed:": "Enter the stopwords to be removed:",
"Enter the special characters to be removed:": "Enter the special characters to be removed:",
"Characters used:": "Characters used:",
"Character length:": "Character length:",
"Order of characters:": "Order of characters:",
"Enter stopwords:": "Enter stopwords:",
"Enter special characters:": "Enter special characters:",
"Please enter text": "Please enter text",
"Seperated by whitespace": "Seperated by whitespace",
"Select the text length per line:": "Select the text length per line:",
"Naver Ads": "Naver Ads",
"Highlighting stopwords": "Highlighting stopwords",
"General Settings": "General Settings",
"Advanced Settings": "Advanced Settings",
"Characters to use when creating random text:": "Characters to use when creating random text:",
"Character Settings": "Character Settings",
"Stopword Settings": "Stopword Settings",
"Import Settings": "Import Settings",
"Reset": "Reset",
"Reseted!": "Reseted!",
"Agree": "Agree",
"Disagree": "Disagree",
"Are you sure you want to reset all settings?": "Are you sure you want to reset all settings?",
"All settings in General Settings and Advanced Settings will be reset.": "All settings in General Settings and Advanced Settings will be reset.",
"Resetting cannot restore existing settings.": "Resetting cannot restore existing settings.",
"All settings will be reset.": "All settings will be reset.",
"Existing settings cannot be restored.": "Existing settings cannot be restored.",
"Remove index column:": "Remove index column:",
"Remove stopwords": "Remove stopwords",
"Reorder random text characters:": "Reorder random text characters:",
"Digit+Word": "Digit+Word",
"Word+Digit": "Word+Digit",
"None": "None",
Expand All @@ -43,11 +45,16 @@
"Duplicate words have been removed!": "Duplicate words have been removed!",
"Stopword List": "Stopword List",
"An error has occurred.": "An error has occurred.",
"Import data": "Import data",
"Import stopwords": "Import stopwords",
"Google spreadsheets publish URL:": "Google spreadsheets publish URL:",
"Enter the address of a google spreadsheets published on the web.": "Enter the address of a google spreadsheets published on the web.",
"Google spreadsheets ID:": "Google spreadsheets ID:",
"Enter the shared google spreadsheets ID.": "Enter the shared google spreadsheets ID.",
"Import stopwords from google spreadsheets:": "Import stopwords from google spreadsheets:"
"Google spreadsheets key:": "Google spreadsheets key:",
"Enter the shared google spreadsheets key.": "Enter the shared google spreadsheets key.",
"Google Spreadsheets data types:": "Google Spreadsheets data types:",
"Would you like to import stopwords?": "Would you like to import stopwords?",
"Import stopwords from Google spreadsheets.": "Import stopwords from Google spreadsheets.",
"Existing stopwords cannot be restored.": "Existing stopwords cannot be restored.",
"Exclude the first line": "Exclude the first line",
"There is {{length}} blank line.": "There is {{length}} blank line.",
"Blank line counting is done before characters are added.": "Blank line counting is done before characters are added."
}
35 changes: 21 additions & 14 deletions src/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@
"Start text": "시작 문자",
"End text": "마지막 문자",
"Random Text": "무작위 문자",
"Length of random text generated:": "생성되는 랜덤 텍스트의 길이:",
"Enter the stopwords to be removed:": "삭제할 금칙어를 입력하세요:",
"Enter the special characters to be removed:": "삭제할 특수 문자를 입력하세요:",
"Please enter text": "텍스트를 입력 하십시오",
"Characters used:": "사용된 문자:",
"Character length:": "문자의 길이:",
"Order of characters:": "문자의 순서:",
"Enter stopwords:": "금칙어를 입력하세요:",
"Enter special characters:": "특수문자를 입력하세요:",
"Please enter text": "텍스트를 입력하세요",
"Seperated by whitespace": "공백으로 구분 합니다",
"Select the text length per line:": "텍스트 길이를 선택하세요:",
"Naver Ads": "네이버 광고",
"Highlighting stopwords": "금칙어 강조 표시",
"General Settings": "일반 설정",
"Advanced Settings": "고급 설정",
"Characters to use when creating random text:": "랜덤 텍스트를 생성할 때 사용할 문자:",
"Character Settings": "문자 설정",
"Stopword Settings": "금칙어 설정",
"Import Settings": "불러오기 설정",
"Reset": "초기화",
"Reseted!": "재설정되었습니다!",
"Agree": "동의",
"Disagree": "미동의",
"Are you sure you want to reset all settings?": "모든 설정을 재설정하시겠습니까?",
"All settings in General Settings and Advanced Settings will be reset.": "일반 설정 및 고급 설정의 모든 설정이 재설정됩니다.",
"Resetting cannot restore existing settings.": "재설정하면 기존 설정을 복원할 수 없습니다.",
"All settings will be reset.": "모든 설정이 재설정됩니다.",
"Existing settings cannot be restored.": "기존 설정은 복원할 수 없습니다.",
"Remove index column:": "인덱스 열 제거:",
"Remove stopwords": "금칙어 중복 제거",
"Reorder random text characters:": "랜덤 텍스트 문자 재정렬:",
"Digit+Word": "숫자+문자",
"Word+Digit": "문자+숫자",
"None": "없음",
Expand All @@ -43,11 +45,16 @@
"Duplicate words have been removed!": "중복된 단어가 제거되었습니다!",
"Stopword List": "금칙어 목록",
"An error has occurred.": "오류가 발생했습니다.",
"Import data": "데이터 가져오기",
"Import stopwords": "금칙어 가져오기",
"Import stopwords": "금칙어 불러오기",
"Google spreadsheets publish URL:": "구글 스프레드시트 발행 주소:",
"Enter the address of a google spreadsheets published on the web.": "웹에 게시된 구글 스프레드시트의 주소를 입력하세요.",
"Google spreadsheets ID:": "구글 스프레드시트 아이디:",
"Enter the shared google spreadsheets ID.": "공유 된 구글 스프레드시트 아이디를 입력하세요.",
"Import stopwords from google spreadsheets:": "구글 스프레드시트에서 금칙어 가져오기:"
"Google spreadsheets key:": "구글 스프레드시트 키:",
"Enter the shared google spreadsheets key.": "공유 된 구글 스프레드시트 키를 입력하세요.",
"Google Spreadsheets data types:": "구글 스프레드시트 데이터 타입:",
"Would you like to import stopwords?": "금칙어를 불러오시겠습니까?",
"Import stopwords from Google spreadsheets.": "구글 스프레드시트에서 금칙어를 불러옵니다.",
"Existing stopwords cannot be restored.": "기존 금칙어는 복원할 수 없습니다.",
"Exclude the first line": "첫 번째 줄을 제외합니다",
"There is {{length}} blank line.": "빈 줄이 {{length}}개 있습니다.",
"Blank line counting is done before characters are added.": "빈 줄 카운팅은 문자가 추가되기 전에 수행됩니다."
}
32 changes: 30 additions & 2 deletions src/pages/Home/components/ActionSection/ImportStopwordsAction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import Backdrop from '@mui/material/Backdrop';
import CircularProgress from '@mui/material/CircularProgress';
import Snackbar from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import { parseGoogleSpreadsheets, getGoogleSpreadsheetsUrl } from '~/modules/parser';
import {
stopwordsState,
Expand All @@ -24,6 +29,7 @@ const Button = styled(MuiButton)(({ theme }) => ({

export default function ImportStopwordsAction() {
const { t } = useTranslation();
const [dialog, setDialog] = useState({ open: false });
const [backdrop, setBackdrop] = useState({ open: false });
const [snackbar, setSnackbar] = useState({
open: false,
Expand All @@ -35,8 +41,9 @@ export default function ImportStopwordsAction() {
const spreadsheetsPublishURL = useRecoilValue(googleSpreadsheetsPublishURLState);
const spreadsheetsID = useRecoilValue(googleSpreadsheetsIDState);

const handleClick = _debounce(() => {
const handleAgree = _debounce(() => {
let url = getGoogleSpreadsheetsUrl(spreadsheetsDataType, spreadsheetsPublishURL, spreadsheetsID);
setDialog({ open: false });
setBackdrop({ open: true });
axios
.get(url)
Expand All @@ -54,9 +61,30 @@ export default function ImportStopwordsAction() {

return (
<>
<Button variant="outlined" size="large" onClick={handleClick}>
<Button variant="outlined" size="large" color="error" onClick={() => setDialog({ open: true })}>
{t('Import stopwords')}
</Button>
<Dialog
open={dialog.open}
onClose={() => setDialog({ open: false })}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{t('Would you like to import stopwords?')}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
{t('Import stopwords from Google spreadsheets.')}
<br />
{t('Existing stopwords cannot be restored.')}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => setDialog({ open: false })}>{t('Disagree')}</Button>
<Button onClick={handleAgree} autoFocus>
{t('Agree')}
</Button>
</DialogActions>
</Dialog>
<Backdrop
sx={{ color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }}
open={backdrop.open}
Expand Down
21 changes: 19 additions & 2 deletions src/pages/Home/components/ActionSection/PreviewPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,35 @@ import { useTranslation } from 'react-i18next';
import { useRecoilValue } from 'recoil';
import Typography from '@mui/material/Typography';
import TextField from '@mui/material/TextField';
import { previewTextState } from '~/store/atoms/main';
import { previewTextState, blankListState } from '~/store/atoms/main';

export default function PreviewPanel() {
const { t } = useTranslation();
const previewText = useRecoilValue(previewTextState);
const blankList = useRecoilValue(blankListState);

return (
<>
<Typography variant="h6" component="h3">
{t('Preview')}
</Typography>
<TextField multiline fullWidth rows={5} value={previewText} disabled variant="outlined" />
<TextField
multiline
fullWidth
rows={5}
value={previewText}
variant="outlined"
error={!!blankList.length}
helperText={
!!blankList.length && (
<>
{t('There is {{length}} blank line.', { length: blankList.length })}{' '}
{t('Blank line counting is done before characters are added.')}
</>
)
}
inputProps={{ readOnly: true }}
/>
</>
);
}
47 changes: 26 additions & 21 deletions src/pages/Home/components/ActionSection/ResetSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,83 +20,88 @@ const Button = styled(MuiButton)(({ theme }) => ({

export default function ResetSettings() {
const { t } = useTranslation();
const [dialogOpen, setDialogOpen] = useState(false);
const [snackbarOpen, setSnackbarOpen] = useState(false);
const [dialog, setDialog] = useState({ open: false });
const [snackbar, setSnackbar] = useState({ open: false });
const storageKey = useRecoilValue(mainState['storageKeyState']);
const resetStates = {
const states = {
// Actions Settings
shuffleTextState: useResetRecoilState(mainState['shuffleTextState']),
previewTextState: useResetRecoilState(mainState['previewTextState']),
consoleTextState: useResetRecoilState(mainState['consoleTextState']),
blankListState: useResetRecoilState(mainState['blankListState']),
marketSettingsState: useResetRecoilState(mainState['marketSettingsState']),

// Global Settings
settingsTabPanelState: useResetRecoilState(mainState['settingsTabPanelState']),

// General Settings
indexColumnState: useResetRecoilState(mainState['indexColumnState']),
lineTextLengthState: useResetRecoilState(mainState['lineTextLengthState']),
specialCharactersState: useResetRecoilState(mainState['specialCharactersState']),
specialCharactersEnabledState: useResetRecoilState(mainState['specialCharactersEnabledState']),
stopwordsState: useResetRecoilState(mainState['stopwordsState']),
stopwordsEnabledState: useResetRecoilState(mainState['stopwordsEnabledState']),
googleSpreadsheetsDataTypeState: useResetRecoilState(mainState['googleSpreadsheetsDataTypeState']),
googleSpreadsheetsPublishURLState: useResetRecoilState(mainState['googleSpreadsheetsPublishURLState']),
googleSpreadsheetsIDState: useResetRecoilState(mainState['googleSpreadsheetsIDState']),

// Advanced Settings: Start
// Character Settings: Start
startEnabledState: useResetRecoilState(mainState['startEnabledState']),
startTextState: useResetRecoilState(mainState['startTextState']),
startChoiceRandomCharacterState: useResetRecoilState(mainState['startChoiceRandomCharacterState']),
startExcludeFirstLineState: useResetRecoilState(mainState['startExcludeFirstLineState']),
startHideRandomTextOptionState: useResetRecoilState(mainState['startHideRandomTextOptionState']),
startUsedRandomCharacterState: useResetRecoilState(mainState['startUsedRandomCharacterState']),
startLimitRandomTextLengthState: useResetRecoilState(mainState['startLimitRandomTextLengthState']),
startReorderRandomTextCharactersState: useResetRecoilState(mainState['startReorderRandomTextCharactersState']),

// Advanced Settings: End
// Character Settings: End
endEnabledState: useResetRecoilState(mainState['endEnabledState']),
endTextState: useResetRecoilState(mainState['endTextState']),
endChoiceRandomCharacterState: useResetRecoilState(mainState['endChoiceRandomCharacterState']),
endExcludeFirstLineState: useResetRecoilState(mainState['endExcludeFirstLineState']),
endHideRandomTextOptionState: useResetRecoilState(mainState['endHideRandomTextOptionState']),
endUsedRandomCharacterState: useResetRecoilState(mainState['endUsedRandomCharacterState']),
endLimitRandomTextLengthState: useResetRecoilState(mainState['endLimitRandomTextLengthState']),
endReorderRandomTextCharactersState: useResetRecoilState(mainState['endReorderRandomTextCharactersState']),
};

const handleAgree = _debounce(() => {
localStorage.removeItem(storageKey);
Object.keys(resetStates).forEach(function (stateName) {
resetStates[stateName]();
Object.keys(states).forEach(function (stateName) {
states[stateName]();
});
setDialogOpen(false);
setSnackbarOpen(true);
setDialog({ open: false });
setSnackbar({ open: true });
}, 100);

return (
<>
<Button variant="outlined" size="large" color="error" onClick={() => setDialogOpen(true)}>
<Button variant="outlined" size="large" color="error" onClick={() => setDialog({ open: true })}>
{t('Reset')}
</Button>
<Dialog
open={dialogOpen}
onClose={() => setDialogOpen(false)}
open={dialog.open}
onClose={() => setDialog({ open: false })}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{t('Are you sure you want to reset all settings?')}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
{t('All settings in General Settings and Advanced Settings will be reset.')}
{t('All settings will be reset.')}
<br />
{t('Resetting cannot restore existing settings.')}
{t('Existing settings cannot be restored.')}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => setDialogOpen(false)}>{t('Disagree')}</Button>
<Button onClick={() => setDialog({ open: false })}>{t('Disagree')}</Button>
<Button onClick={handleAgree} autoFocus>
{t('Agree')}
</Button>
</DialogActions>
</Dialog>
<Snackbar
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
open={snackbarOpen}
open={snackbar.open}
autoHideDuration={1000}
onClose={() => setSnackbarOpen(false)}
onClose={() => setSnackbar({ open: false })}
>
<Alert severity="success">{t('Reseted!')}</Alert>
</Snackbar>
Expand Down
Loading

0 comments on commit 749ce3a

Please sign in to comment.