feat: add translation for integration settings
This commit is contained in:
@@ -15,6 +15,7 @@ import { useGlobalInfoStore } from "../../context/globalInfo";
|
|||||||
import { getStoredRecording } from "../../api/storage";
|
import { getStoredRecording } from "../../api/storage";
|
||||||
import { apiUrl } from "../../apiConfig.js";
|
import { apiUrl } from "../../apiConfig.js";
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
interface IntegrationProps {
|
interface IntegrationProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@@ -33,6 +34,7 @@ export const IntegrationSettingsModal = ({
|
|||||||
handleStart,
|
handleStart,
|
||||||
handleClose,
|
handleClose,
|
||||||
}: IntegrationProps) => {
|
}: IntegrationProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const [settings, setSettings] = useState<IntegrationSettings>({
|
const [settings, setSettings] = useState<IntegrationSettings>({
|
||||||
spreadsheetId: "",
|
spreadsheetId: "",
|
||||||
spreadsheetName: "",
|
spreadsheetName: "",
|
||||||
@@ -168,38 +170,28 @@ export const IntegrationSettingsModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericModal isOpen={isOpen} onClose={handleClose} modalStyle={modalStyle}>
|
<GenericModal isOpen={isOpen} onClose={handleClose} modalStyle={modalStyle}>
|
||||||
<div
|
<div style={{
|
||||||
style={{
|
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
marginLeft: "65px",
|
marginLeft: "65px",
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
<Typography variant="h6">
|
<Typography variant="h6">
|
||||||
Integrate with Google Sheet{" "}
|
{t('integration_settings.title')}
|
||||||
{/* <Chip label="beta" color="primary" variant="outlined" /> */}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
{recording && recording.google_sheet_id ? (
|
{recording && recording.google_sheet_id ? (
|
||||||
<>
|
<>
|
||||||
<Alert severity="info" sx={{ marginTop: '10px', border: '1px solid #ff00c3' }}>
|
<Alert severity="info" sx={{ marginTop: '10px', border: '1px solid #ff00c3' }}>
|
||||||
<AlertTitle>Google Sheet Integrated Successfully.</AlertTitle>
|
<AlertTitle>{t('integration_settings.alerts.success.title')}</AlertTitle>
|
||||||
Every time this robot creates a successful run, its captured data
|
{t('integration_settings.alerts.success.content', { sheetName: recording.google_sheet_name })}
|
||||||
is appended to your {recording.google_sheet_name} Google Sheet.
|
<a href={`https://docs.google.com/spreadsheets/d/${recording.google_sheet_id}`}
|
||||||
You can check the data updates{" "}
|
|
||||||
<a
|
|
||||||
href={`https://docs.google.com/spreadsheets/d/${recording.google_sheet_id}`}
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer">
|
||||||
>
|
{t('integration_settings.alerts.success.here')}
|
||||||
here
|
</a>.
|
||||||
</a>
|
|
||||||
.
|
|
||||||
<br />
|
<br />
|
||||||
<strong>Note:</strong> The data extracted before integrating with
|
<strong>{t('integration_settings.alerts.success.note')}</strong> {t('integration_settings.alerts.success.sync_limitation')}
|
||||||
Google Sheets will not be synced in the Google Sheet. Only the
|
|
||||||
data extracted after the integration will be synced.
|
|
||||||
</Alert>
|
</Alert>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -207,31 +199,29 @@ export const IntegrationSettingsModal = ({
|
|||||||
onClick={removeIntegration}
|
onClick={removeIntegration}
|
||||||
style={{ marginTop: "15px" }}
|
style={{ marginTop: "15px" }}
|
||||||
>
|
>
|
||||||
Remove Integration
|
{t('integration_settings.buttons.remove_integration')}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!recording?.google_sheet_email ? (
|
{!recording?.google_sheet_email ? (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>{t('integration_settings.descriptions.sync_info')}</p>
|
||||||
If you enable this option, every time this robot runs a task
|
|
||||||
successfully, its captured data will be appended to your
|
|
||||||
Google Sheet.
|
|
||||||
</p>
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={authenticateWithGoogle}
|
onClick={authenticateWithGoogle}
|
||||||
>
|
>
|
||||||
Authenticate with Google
|
{t('integration_settings.buttons.authenticate')}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{recording.google_sheet_email && (
|
{recording.google_sheet_email && (
|
||||||
<Typography sx={{ margin: "20px 0px 30px 0px" }}>
|
<Typography sx={{ margin: "20px 0px 30px 0px" }}>
|
||||||
Authenticated as: {recording.google_sheet_email}
|
{t('integration_settings.descriptions.authenticated_as', {
|
||||||
|
email: recording.google_sheet_email
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -247,14 +237,14 @@ export const IntegrationSettingsModal = ({
|
|||||||
color="primary"
|
color="primary"
|
||||||
onClick={fetchSpreadsheetFiles}
|
onClick={fetchSpreadsheetFiles}
|
||||||
>
|
>
|
||||||
Fetch Google Spreadsheets
|
{t('integration_settings.buttons.fetch_sheets')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="error"
|
color="error"
|
||||||
onClick={removeIntegration}
|
onClick={removeIntegration}
|
||||||
>
|
>
|
||||||
Remove Integration
|
{t('integration_settings.buttons.remove_integration')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -263,7 +253,7 @@ export const IntegrationSettingsModal = ({
|
|||||||
<TextField
|
<TextField
|
||||||
sx={{ marginBottom: "15px" }}
|
sx={{ marginBottom: "15px" }}
|
||||||
select
|
select
|
||||||
label="Select Google Sheet"
|
label={t('integration_settings.fields.select_sheet')}
|
||||||
required
|
required
|
||||||
value={settings.spreadsheetId}
|
value={settings.spreadsheetId}
|
||||||
onChange={handleSpreadsheetSelect}
|
onChange={handleSpreadsheetSelect}
|
||||||
@@ -278,13 +268,10 @@ export const IntegrationSettingsModal = ({
|
|||||||
|
|
||||||
{settings.spreadsheetId && (
|
{settings.spreadsheetId && (
|
||||||
<Typography sx={{ marginBottom: "10px" }}>
|
<Typography sx={{ marginBottom: "10px" }}>
|
||||||
Selected Sheet:{" "}
|
{t('integration_settings.fields.selected_sheet', {
|
||||||
{
|
name: spreadsheets.find((s) => s.id === settings.spreadsheetId)?.name,
|
||||||
spreadsheets.find(
|
id: settings.spreadsheetId
|
||||||
(s) => s.id === settings.spreadsheetId
|
})}
|
||||||
)?.name
|
|
||||||
}{" "}
|
|
||||||
(ID: {settings.spreadsheetId})
|
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -298,7 +285,7 @@ export const IntegrationSettingsModal = ({
|
|||||||
style={{ marginTop: "10px" }}
|
style={{ marginTop: "10px" }}
|
||||||
disabled={!settings.spreadsheetId || loading}
|
disabled={!settings.spreadsheetId || loading}
|
||||||
>
|
>
|
||||||
Submit
|
{t('integration_settings.buttons.submit')}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user