Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/remix-ide/src/app/tabs/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"settings.analyticsDescription": "Control how Remix uses AI and analytics to improve your experience.",
"settings.aiDescription": "The Remix AI Assistant enhances your coding experience with smart suggestions and automated insights. Manage how AI interacts with your code and data.",
"settings.servicesDescription": "Configure the settings for connected services, including Github, IPFS, Swarm, Sindri and Etherscan.",
"settings.matomoAnalyticsNoCookies": "Matomo Analytics (no cookies)",
"settings.matomoAnalyticsNoCookies": "Matomo Analytics (necessary, no cookies)",
"settings.matomoAnalyticsNoCookiesDescription": "Help improve Remix with anonymous usage data.",
"settings.matomoAnalyticsWithCookies": "Matomo Analytics (with cookies)",
"settings.matomoAnalyticsWithCookies": "Matomo Performance Analytics (with cookies)",
"settings.matomoAnalyticsWithCookiesDescription": "Enable tracking with cookies for more detailed insights.",
"settings.aiCopilot": "AI Copilot",
"settings.aiCopilotDescription": "AI Copilot assists with code suggestions and improvements.",
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/tabs/settings-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const _paq = (window._paq = window._paq || [])
const profile = {
name: 'settings',
displayName: 'Settings',
methods: ['get', 'updateCopilotChoice', 'getCopilotSetting'],
methods: ['get', 'updateCopilotChoice', 'getCopilotSetting', 'updateMatomoPerfAnalyticsChoice'],
events: [],
icon: 'assets/img/settings.webp',
description: 'Remix-IDE settings',
Expand Down
6 changes: 1 addition & 5 deletions libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,9 @@ const settingsSections: SettingsSection[] = [
{ options: [{
name: 'matomo-analytics',
label: 'settings.matomoAnalyticsNoCookies',
headerClass: 'text-secondary',
type: 'toggle',
description: 'settings.matomoAnalyticsNoCookiesDescription',
footnote: {
text: 'Learn more about analytics',
link: 'https://matomo.org/',
styleClass: 'text-primary'
}
}, {
name: 'matomo-perf-analytics',
label: 'settings.matomoAnalyticsWithCookies',
Expand Down
7 changes: 3 additions & 4 deletions libs/remix-ui/settings/src/lib/settings-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ export const SettingsSectionUI: React.FC<SettingsSectionUIProps> = ({ plugin, se
const handleToggle = (name: string) => {
if (state[name]) {
const newValue = !state[name].value

dispatch({ type: 'SET_LOADING', payload: { name: name } })
dispatch({ type: 'SET_VALUE', payload: { name: name, value: newValue } })
// _paq.push(['disableCookies'])
if (!newValue && formUIData[name]) {
Object.keys(formUIData[name]).forEach((key) => {
dispatch({ type: 'SET_VALUE', payload: { name: key, value: '' } })
})
dispatch({ type: 'SET_TOAST_MESSAGE', payload: { value: 'Credentials removed' } })
}
if (name === 'copilot/suggest/activate') plugin.emit('copilotChoiceUpdated', newValue)
if (name === 'matomo-perf-analytics') plugin.call('settings', 'updateMatomoPerfAnalyticsChoice', newValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should also emit an event, same as above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is not required here as there is no such event and it is not being listened anywhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is just to be consistent with the line above plugin.emit('copilotChoiceUpdated', newValue)

if (name === 'text-wrap') plugin.emit('textWrapChoiceUpdated', newValue)
} else {
console.error('Setting does not exist: ', name)
Expand Down Expand Up @@ -94,15 +93,15 @@ export const SettingsSectionUI: React.FC<SettingsSectionUIProps> = ({ plugin, se
return (
<div className={`card border-0 rounded-0 ${isLastOption ? 'pt-3 pb-0' : isFirstOption ? 'border-bottom pb-3' : 'border-bottom py-3'}`} key={optionIndex}>
<div className="d-flex align-items-center">
<h5 data-id={`settingsTab${option.name}Label`} className={`${isDark ? 'text-white' : 'text-black'} m-0`}>
<h5 data-id={`settingsTab${option.name}Label`} className={`${option.headerClass || (isDark ? 'text-white' : 'text-black')} m-0`}>
<FormattedMessage id={option.label} />
{option.labelIconTooltip ?
<CustomTooltip tooltipText={<FormattedMessage id={option.labelIconTooltip} />}><i className={option.labelIcon}></i></CustomTooltip> :
option.labelIcon && <i className={option.labelIcon}></i>
}
</h5>
<div className="ms-auto">
{option.type === 'toggle' && <ToggleSwitch id={option.name} isOn={toggleValue} onClick={() => handleToggle(option.name)} />}
{option.type === 'toggle' && <ToggleSwitch id={option.name} isOn={toggleValue} onClick={() => handleToggle(option.name)} disabled = {option.name === "matomo-analytics" ? true : false}/>}
{option.type === 'select' && <div style={{ minWidth: '110px' }}><SelectDropdown value={selectValue} options={option.selectOptions} name={option.name} dispatch={dispatch as any} /></div>}
{option.type === 'button' && <button className="btn btn-secondary btn-sm" onClick={() => handleButtonClick(option.buttonOptions)}><FormattedMessage id={option.buttonOptions.label} /></button>}
</div>
Expand Down
1 change: 1 addition & 0 deletions libs/remix-ui/settings/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface SettingsSection {
name: keyof SettingsState,
label: string,
labelIcon?: string,
headerClass?: string,
labelIconTooltip?: string,
description?: string | JSX.Element,
footnote?: {
Expand Down