Trying to fix the settings

This commit is contained in:
sageTheDM 2024-09-26 09:29:04 +02:00
parent 289ff78b60
commit a05b9d6a5f
10 changed files with 305 additions and 274 deletions

View file

@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
const Models: React.FC = () => { // Define the available model options
const modelOptions = [ const modelOptions = [
'Offline Fast', 'Offline Fast',
'Offline Fast (FOSS)', 'Offline Fast (FOSS)',
@ -16,106 +16,134 @@ const Models: React.FC = () => {
'Online Expensive (Google)', 'Online Expensive (Google)',
]; ];
const [selectedModel, setSelectedModel] = useState<string>(() => { // Define the properties passed to the Models component
// Load the selected model from localStorage on initial render interface ModelsProps {
return localStorage.getItem('selectedModel') || 'Offline Fast'; selectedOption: string; // Privacy setting: "Offline", "AI Online", "None"
}); }
const handleModelChange = (event: React.ChangeEvent<HTMLSelectElement>) => { const Models: React.FC<ModelsProps> = ({ selectedOption }) => {
const newModel = event.target.value; // State for the selected model, default is loaded from localStorage or defaults to 'Offline Fast'
setSelectedModel(newModel); const [selectedModel, setSelectedModel] = useState<string>(() => {
}; return localStorage.getItem('selectedModel') || 'Offline Fast';
});
const isOfflineModel = (model: string) => { // Handle changes in the selected model from the dropdown
return model.includes('Offline'); const handleModelChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
}; const newModel = event.target.value;
setSelectedModel(newModel);
};
// Save selected model to localStorage whenever it changes // Utility function to check if a model is an offline model
useEffect(() => { const isOfflineModel = (model: string) => {
localStorage.setItem('selectedModel', selectedModel); return model.includes('Offline');
}, [selectedModel]); };
return ( // Utility function to check if a model is an online model
<div className="model-background"> const isOnlineModel = (model: string) => {
<div className="models"> return model.includes('Online');
<div className="titel"> };
<h1>Different AI models</h1>
</div> // Save selected model to localStorage whenever it changes
<div className="model-dropdown"> useEffect(() => {
<label htmlFor="model-select">Select AI Model:</label> localStorage.setItem('selectedModel', selectedModel);
<select id="model-select" value={selectedModel} onChange={handleModelChange}> }, [selectedModel]);
{modelOptions.map((model) => (
<option key={model} value={model}> // Filter models based on the selected privacy option (Offline, AI Online, None)
{model} const filteredModels = modelOptions.filter((model) => {
</option> if (selectedOption === 'Offline') {
))} return !isOnlineModel(model); // Hide online models
</select> } else if (selectedOption === 'AI Online') {
</div> return !isOfflineModel(model); // Hide offline models
<div className="grid"> } else {
<button className="code-model model-box"> return true; // Show all models for "None"
<div className="overlay"> }
<h3>Code</h3> });
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</div> return (
</button> <div className="model-background">
<button className="math-model model-box"> <div className="models">
<div className="overlay"> <div className="title">
<h3>Math</h3> <h3>Different AI models</h3>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} </div>
</div>
</button> {/* Model Selection Dropdown */}
<button className="language-model model-box"> <div className="model-dropdown">
<div className="overlay"> <label htmlFor="model-select">Select AI Model:</label>
<h3>Language</h3> <select id="model-select" value={selectedModel} onChange={handleModelChange}>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} {filteredModels.map((model) => (
</div> <option key={model} value={model}>
</button> {model}
<button className="character-model model-box"> </option>
<div className="overlay"> ))}
<h3>Character</h3> </select>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} </div>
</div>
</button> {/* Model Grid with Cards */}
<button className="financial-model model-box"> <div className="grid">
<div className="overlay"> <button className="code-model model-box">
<h3>Finance</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Code</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
<button className="weather-model model-box"> </button>
<div className="overlay"> <button className="math-model model-box">
<h3>Weather</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Math</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
<button className="time-planner-model model-box"> </button>
<div className="overlay"> <button className="language-model model-box">
<h3>Time</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Language</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
<button className="image-model model-box"> </button>
<div className="overlay"> <button className="character-model model-box">
<h3>Image</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Character</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
<button className="default-model model-box"> </button>
<div className="overlay"> <button className="financial-model model-box">
<h3>Custom1</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Finance</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
<button className="default-model model-box"> </button>
<div className="overlay"> <button className="weather-model model-box">
<h3>Custom2</h3> <div className="overlay">
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />} <h3>Weather</h3>
</div> {isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</button> </div>
</button>
<button className="time-planner-model model-box">
<div className="overlay">
<h3>Time</h3>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</div>
</button>
<button className="image-model model-box">
<div className="overlay">
<h3>Image</h3>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Custom1</h3>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Custom2</h3>
{isOfflineModel(selectedModel) && <img src="/img/nowifi.svg" alt="No Wi-Fi" />}
</div>
</button>
</div>
</div> </div>
</div> </div>
</div> );
); };
};
export default Models; export default Models;

View file

@ -6,7 +6,17 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
const getItemFromLocalStorage = (key: string) => { const getItemFromLocalStorage = (key: string) => {
const item = localStorage.getItem(key); const item = localStorage.getItem(key);
return item ? JSON.parse(item) : false; // Default to false if item is null
if (item) {
try {
return JSON.parse(item); // Attempt to parse the item
} catch (e) {
console.error(`Error parsing JSON for key "${key}":`, e);
return false; // Return false if parsing fails
}
}
return false; // Default to false if item is null or empty
}; };
// Active section // Active section
@ -14,30 +24,29 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
// Language setting // Language setting
const [preferredLanguage, setPreferredLanguage] = useState(() => localStorage.getItem('preferredLanguage') || 'en'); const [preferredLanguage, setPreferredLanguage] = useState(() => localStorage.getItem('preferredLanguage') || 'en');
// Currency setting // Currency setting
const [preferredCurrency, setPreferredCurrency] = useState(() => localStorage.getItem('preferredCurrency') || 'usd'); const [preferredCurrency, setPreferredCurrency] = useState(() => localStorage.getItem('preferredCurrency') || 'usd');
// Date and time format settings // Date and time format settings
const [dateFormat, setDateFormat] = useState(() => localStorage.getItem('dateFormat') || 'mm/dd/yyyy'); const [dateFormat, setDateFormat] = useState(() => localStorage.getItem('dateFormat') || 'mm/dd/yyyy');
const [timeFormat, setTimeFormat] = useState(() => localStorage.getItem('timeFormat') || '12-hour'); const [timeFormat, setTimeFormat] = useState(() => localStorage.getItem('timeFormat') || '12-hour');
const [timeZone, setTimeZone] = useState(() => localStorage.getItem('timeZone') || 'GMT'); const [timeZone, setTimeZone] = useState(() => localStorage.getItem('timeZone') || 'GMT');
// Online AI and chat history settings // Online AI and chat history settings
// State declarations const [selectedOption, setSelectedOption] = useState('Offline'); // Default to 'Offline'
const [disableOnlineAI, setDisableOnlineAI] = useState(() => getItemFromLocalStorage('disableOnlineAI'));
const [disableChatHistory, setDisableChatHistory] = useState(() => getItemFromLocalStorage('disableChatHistory')); const [disableChatHistory, setDisableChatHistory] = useState(() => getItemFromLocalStorage('disableChatHistory'));
const [disableAIMemory, setDisableAIMemory] = useState(() => getItemFromLocalStorage('disableAIMemory')); const [disableAIMemory, setDisableAIMemory] = useState(() => getItemFromLocalStorage('disableAIMemory'));
const [openSourceMode, setOpenSourceMode] = useState(() => getItemFromLocalStorage('openSourceMode')); const [openSourceMode, setOpenSourceMode] = useState(() => getItemFromLocalStorage('openSourceMode'));
// User credentials // User credentials
const [newName, setNewName] = useState(() => localStorage.getItem('newName') || ''); const [newName, setNewName] = useState(() => localStorage.getItem('newName') || '');
const [newEmail, setNewEmail] = useState(() => localStorage.getItem('newEmail') || ''); const [newEmail, setNewEmail] = useState(() => localStorage.getItem('newEmail') || '');
const [newPassword, setNewPassword] = useState(() => localStorage.getItem('newPassword') || ''); const [newPassword, setNewPassword] = useState(() => localStorage.getItem('newPassword') || '');
// Measurement setting // Measurement setting
const [preferredMeasurement, setPreferredMeasurement] = useState(() => localStorage.getItem('preferredMeasurement') || 'Metric'); const [preferredMeasurement, setPreferredMeasurement] = useState(() => localStorage.getItem('preferredMeasurement') || 'Metric');
// Theme settings // Theme settings
const [backgroundColor, setBackgroundColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--background-color').trim()); const [backgroundColor, setBackgroundColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--background-color').trim());
const [textColor, setTextColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--text-color').trim()); const [textColor, setTextColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--text-color').trim());
@ -58,174 +67,124 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
const [inputBorderColor, setInputBorderColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--input-border-color').trim()); const [inputBorderColor, setInputBorderColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--input-border-color').trim());
const [fontFamily, setFontFamily] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--font-family').trim()); const [fontFamily, setFontFamily] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--font-family').trim());
const [fontSize, setFontSize] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--font-size').trim()); const [fontSize, setFontSize] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--font-size').trim());
const [burgerMenu, setBurgerMenu] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--burger-menu-background-color:').trim()); const [burgerMenu, setBurgerMenu] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--burger-menu-background-color').trim());
// Theme selection // Theme selection
const [selectedTheme, setSelectedTheme] = useState(() => localStorage.getItem('selectedTheme') || 'default'); const [selectedTheme, setSelectedTheme] = useState(() => localStorage.getItem('selectedTheme') || 'default');
// API Keys // API Keys
const [laPlateforme, setLaPlateforme] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-la-plateforme').trim()); const [laPlateforme, setLaPlateforme] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-la-plateforme').trim());
const [openAI, setOpenAI] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-openai').trim()); const [openAI, setOpenAI] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-openai').trim());
const [anthropic, setAnthropic] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-anthropic').trim()); const [anthropic, setAnthropic] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-anthropic').trim());
const [google, setGoogle] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-google').trim()); const [google, setGoogle] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-google').trim());
// Effect hooks to update localStorage whenever any state changes // Effect hooks to update localStorage whenever any state changes
useEffect(() => { useEffect(() => {
localStorage.setItem('activeSection', activeSection); const settings = {
}, [activeSection]); activeSection,
preferredLanguage,
useEffect(() => { preferredCurrency,
localStorage.setItem('preferredLanguage', preferredLanguage); dateFormat,
}, [preferredLanguage]); timeFormat,
timeZone,
useEffect(() => { selectedOption,
localStorage.setItem('preferredCurrency', preferredCurrency); disableChatHistory,
}, [preferredCurrency]); disableAIMemory,
openSourceMode,
useEffect(() => { newName,
localStorage.setItem('dateFormat', dateFormat); newEmail,
}, [dateFormat]); newPassword,
preferredMeasurement,
useEffect(() => { backgroundColor,
localStorage.setItem('timeFormat', timeFormat); textColor,
}, [timeFormat]); inputBackgroundColor,
inputButtonColor,
useEffect(() => { inputButtonHoverColor,
localStorage.setItem('timeZone', timeZone); userMessageBackgroundColor,
}, [timeZone]); userMessageTextColor,
aiMessageBackgroundColor,
useEffect(() => { aiMessageTextColor,
localStorage.setItem('disableOnlineAI', JSON.stringify(disableOnlineAI)); buttonBackgroundColor,
}, [disableOnlineAI]); buttonHoverBackgroundColor,
modelsBackgroundColor,
useEffect(() => { historyBackgroundColor,
localStorage.setItem('disableChatHistory', JSON.stringify(disableChatHistory)); leftPanelBackgroundColor,
}, [disableChatHistory]); conversationBackgroundColor,
popUpTextColor,
useEffect(() => { inputBorderColor,
localStorage.setItem('disableAIMemory', JSON.stringify(disableAIMemory)); fontFamily,
}, [disableAIMemory]); fontSize,
burgerMenu,
useEffect(() => { selectedTheme,
localStorage.setItem('openSourceMode', JSON.stringify(openSourceMode)); laPlateforme,
}, [openSourceMode]); openAI,
anthropic,
useEffect(() => { google,
localStorage.setItem('newName', newName); };
}, [newName]);
// Update local storage
useEffect(() => { for (const [key, value] of Object.entries(settings)) {
localStorage.setItem('newEmail', newEmail); if (typeof value === 'boolean') {
}, [newEmail]); localStorage.setItem(key, JSON.stringify(value));
} else {
useEffect(() => { localStorage.setItem(key, value);
localStorage.setItem('newPassword', newPassword); }
}, [newPassword]); }
}, [
useEffect(() => { activeSection,
localStorage.setItem('preferredMeasurement', preferredMeasurement); preferredLanguage,
}, [preferredMeasurement]); preferredCurrency,
dateFormat,
useEffect(() => { timeFormat,
localStorage.setItem('backgroundColor', backgroundColor); timeZone,
}, [backgroundColor]); selectedOption,
disableChatHistory,
useEffect(() => { disableAIMemory,
localStorage.setItem('textColor', textColor); openSourceMode,
}, [textColor]); newName,
newEmail,
useEffect(() => { newPassword,
localStorage.setItem('inputBackgroundColor', inputBackgroundColor); preferredMeasurement,
}, [inputBackgroundColor]); backgroundColor,
textColor,
useEffect(() => { inputBackgroundColor,
localStorage.setItem('inputButtonColor', inputButtonColor); inputButtonColor,
}, [inputButtonColor]); inputButtonHoverColor,
userMessageBackgroundColor,
useEffect(() => { userMessageTextColor,
localStorage.setItem('inputButtonHoverColor', inputButtonHoverColor); aiMessageBackgroundColor,
}, [inputButtonHoverColor]); aiMessageTextColor,
buttonBackgroundColor,
useEffect(() => { buttonHoverBackgroundColor,
localStorage.setItem('userMessageBackgroundColor', userMessageBackgroundColor); modelsBackgroundColor,
}, [userMessageBackgroundColor]); historyBackgroundColor,
leftPanelBackgroundColor,
useEffect(() => { conversationBackgroundColor,
localStorage.setItem('userMessageTextColor', userMessageTextColor); popUpTextColor,
}, [userMessageTextColor]); inputBorderColor,
fontFamily,
useEffect(() => { fontSize,
localStorage.setItem('aiMessageBackgroundColor', aiMessageBackgroundColor); burgerMenu,
}, [aiMessageBackgroundColor]); selectedTheme,
laPlateforme,
useEffect(() => { openAI,
localStorage.setItem('aiMessageTextColor', aiMessageTextColor); anthropic,
}, [aiMessageTextColor]); google,
]);
useEffect(() => {
localStorage.setItem('buttonBackgroundColor', buttonBackgroundColor); useEffect(() => {
}, [buttonBackgroundColor]); const savedOption = localStorage.getItem('radioSelection');
if (savedOption) {
useEffect(() => { setSelectedOption(savedOption); // Set saved selection
localStorage.setItem('buttonHoverBackgroundColor', buttonHoverBackgroundColor); }
}, [buttonHoverBackgroundColor]); }, []);
useEffect(() => { const handleRadioChange = (newValue: string) => {
localStorage.setItem('modelsBackgroundColor', modelsBackgroundColor); setSelectedOption(newValue); // Update the state with the selected option
}, [modelsBackgroundColor]); localStorage.setItem('radioSelection', newValue); // Save the selection for persistence
};
useEffect(() => {
localStorage.setItem('historyBackgroundColor', historyBackgroundColor);
}, [historyBackgroundColor]);
useEffect(() => {
localStorage.setItem('leftPanelBackgroundColor', leftPanelBackgroundColor);
}, [leftPanelBackgroundColor]);
useEffect(() => {
localStorage.setItem('conversationBackgroundColor', conversationBackgroundColor);
}, [conversationBackgroundColor]);
useEffect(() => {
localStorage.setItem('popUpTextColor', popUpTextColor);
}, [popUpTextColor]);
useEffect(() => {
localStorage.setItem('inputBorderColor', inputBorderColor);
}, [inputBorderColor]);
useEffect(() => {
localStorage.setItem('fontFamily', fontFamily);
}, [fontFamily]);
useEffect(() => {
localStorage.setItem('fontSize', fontSize);
}, [fontSize]);
useEffect(() => {
localStorage.setItem('burgerMenu', burgerMenu);
}, [fontSize]);
useEffect(() => {
localStorage.setItem('selectedTheme', selectedTheme);
}, [selectedTheme]);
useEffect(() => {
localStorage.setItem('laPlateforme', laPlateforme);
}, [laPlateforme]);
useEffect(() => {
localStorage.setItem('openAI', openAI);
}, [openAI]);
useEffect(() => {
localStorage.setItem('anthropic', anthropic);
}, [anthropic]);
useEffect(() => {
localStorage.setItem('google', google);
}, [google]);
// Apply imported settings to the CSS variables // Apply imported settings to the CSS variables
const applySettings = (settings: any) => { const applySettings = (settings: any) => {
if (settings.backgroundColor) { if (settings.backgroundColor) {
@ -439,16 +398,33 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
return ( return (
<div className="settings-section"> <div className="settings-section">
<h2>Privacy Settings</h2> <h2>Privacy Settings</h2>
{/* AI Mode Radio Options */}
<div className="settings-option"> <div className="settings-option">
<label> <p>Disable Options:</p>
<input <div className="slider">
type="checkbox" <div
checked={disableOnlineAI} className={`slider-option ${selectedOption === 'Offline' ? 'active' : ''}`}
onChange={() => setDisableOnlineAI(!disableOnlineAI)} onClick={() => handleRadioChange('Offline')} // Handle selection
/> >
Disable Online AI Offline tools
</label> </div>
<div
className={`slider-option ${selectedOption === 'AI Online' ? 'active' : ''}`}
onClick={() => handleRadioChange('AI Online')}
>
Online tools
</div>
<div
className={`slider-option ${selectedOption === 'None' ? 'active' : ''}`}
onClick={() => handleRadioChange('None')}
>
None
</div>
</div>
</div> </div>
{/* Disable Chat History Checkbox */}
<div className="settings-option"> <div className="settings-option">
<label> <label>
<input <input
@ -459,6 +435,8 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
Disable Chat History Disable Chat History
</label> </label>
</div> </div>
{/* Disable AI Memory Checkbox */}
<div className="settings-option"> <div className="settings-option">
<label> <label>
<input <input
@ -941,7 +919,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
dateFormat, dateFormat,
timeFormat, timeFormat,
timeZone, timeZone,
disableOnlineAI, selectedOption,
disableChatHistory, disableChatHistory,
disableAIMemory, disableAIMemory,
openSourceMode, openSourceMode,

View file

@ -159,4 +159,29 @@
background-color: var(--button-hover-background-color); background-color: var(--button-hover-background-color);
padding: 10px; padding: 10px;
margin: 10px; margin: 10px;
} }
.slider {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
.slider-option {
cursor: pointer;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
transition: background-color 0.3s;
}
.slider-option.active {
background-color: #007bff; /* Change to your active color */
color: white;
border-color: #007bff;
}
input[type="radio"] {
display: none; /* Hide the default radio buttons */
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 555 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB