refactor: clean translation system and more widget stuff

This commit is contained in:
David Ralph
2022-08-26 10:45:32 +01:00
parent cd311e0fa1
commit 2c2acbba46
71 changed files with 1028 additions and 999 deletions

View File

@@ -2,13 +2,13 @@ import variables from 'modules/variables';
import './preview.scss';
export default function Notification(props) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
return (
<div className="preview-mode">
<span className="title">{getMessage('modals.main.settings.reminder.title')}</span>
<span className="subtitle">{getMessage('modals.welcome.preview.description')}</span>
<button onClick={() => props.setup()}>{getMessage('modals.welcome.preview.continue')}</button>
<span className="title">{variables.getMessage('modals.main.settings.reminder.title')}</span>
<span className="subtitle">{variables.getMessage('modals.welcome.preview.description')}</span>
<button onClick={() => props.setup()}>
{variables.getMessage('modals.welcome.preview.continue')}
</button>
</div>
);
}

View File

@@ -2,13 +2,13 @@ import variables from 'modules/variables';
import './preview.scss';
export default function Preview(props) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
return (
<div className="preview-mode">
<span className="title">{getMessage('modals.main.settings.reminder.title')}</span>
<span className="subtitle">{getMessage('modals.welcome.preview.description')}</span>
<button onClick={() => props.setup()}>{getMessage('modals.welcome.preview.continue')}</button>
<span className="title">{variables.getMessage('modals.main.settings.reminder.title')}</span>
<span className="subtitle">{variables.getMessage('modals.welcome.preview.description')}</span>
<button onClick={() => props.setup()}>
{variables.getMessage('modals.welcome.preview.continue')}
</button>
</div>
);
}

View File

@@ -9,12 +9,11 @@ import { toast } from 'react-toastify';
import './sharemodal.scss';
export default function ShareModal({ modalClose, data }) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
const url = variables.constants.MARKETPLACE_URL + '/share/' + btoa(data.api_name);
const copyLink = () => {
navigator.clipboard.writeText(data);
toast(getMessage('modals.share.copy_link'));
toast(variables.getMessage('modals.share.copy_link'));
};
// look into what's wrong with this
@@ -27,8 +26,8 @@ export default function ShareModal({ modalClose, data }) {
return (
<div className="smallModal">
<div className="shareHeader">
<span className="title">{getMessage('widgets.quote.share')}</span>
<Tooltip title={getMessage('modals.welcome.buttons.close')}>
<span className="title">{variables.getMessage('widgets.quote.share')}</span>
<Tooltip title={variables.getMessage('modals.welcome.buttons.close')}>
<div className="close" onClick={modalClose}>
<MdClose />
</div>
@@ -103,7 +102,7 @@ export default function ShareModal({ modalClose, data }) {
</div>
<div className="copy">
<input type="text" value={data} className="left field" readOnly />
<Tooltip title={getMessage('modals.share.copy_link')} placement="top">
<Tooltip title={variables.getMessage('modals.share.copy_link')} placement="top">
<button onClick={() => copyLink()}>
<MdContentCopy />
</button>

View File

@@ -7,8 +7,6 @@ import Tooltip from './Tooltip';
import './tooltip.scss';
export default function InfoTooltip({ title, style, placement, subtitle }) {
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
const [showTooltip, setShowTooltip] = useState(false);
const { x, y, reference, floating, strategy } = useFloating({
placement: placement || 'top-start',
@@ -30,7 +28,7 @@ export default function InfoTooltip({ title, style, placement, subtitle }) {
>
<div className="tooltipHeader">
<span className="title">{title}</span>
<Tooltip title={getMessage('modals.welcome.buttons.close')}>
<Tooltip title={variables.getMessage('modals.welcome.buttons.close')}>
<div className="close" onClick={() => setShowTooltip(false)}>
<MdClose />
</div>
@@ -38,7 +36,7 @@ export default function InfoTooltip({ title, style, placement, subtitle }) {
</div>
<span className="subtitle">{subtitle}</span>
<span className="link">
{getMessage('modals.main.settings.open_knowledgebase')} <MdOpenInNew />
{variables.getMessage('modals.main.settings.open_knowledgebase')} <MdOpenInNew />
</span>
</div>
)}