Skip to content

Commit aa4b6ee

Browse files
fix theme config page when theme is forced
Signed-off-by: Guillaume BERNARD <guillaume.bernard@live.fr>
1 parent a6294cb commit aa4b6ee

File tree

13 files changed

+32
-4
lines changed

13 files changed

+32
-4
lines changed

frontend/src/components/App/Settings/Settings.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default function Settings() {
5252
const dispatch = useDispatch();
5353
const themeName = useTypedSelector(state => state.theme.name);
5454
const appThemes = useAppThemes();
55+
const forceTheme = useTypedSelector(state => state.config.forceTheme);
5556

5657
useEffect(() => {
5758
dispatch(
@@ -200,6 +201,19 @@ export default function Settings() {
200201
pb: 5,
201202
}}
202203
>
204+
{forceTheme && (
205+
<Typography
206+
variant="body2"
207+
sx={theme => ({
208+
textAlign: 'center',
209+
color: theme.palette.text.secondary,
210+
fontStyle: 'italic',
211+
mb: 2,
212+
})}
213+
>
214+
{t('translation|Theme has been forced by your administrator')}
215+
</Typography>
216+
)}
203217
<Box
204218
sx={{
205219
display: 'grid',
@@ -210,18 +224,20 @@ export default function Settings() {
210224
gridTemplateColumns: 'repeat(auto-fit, minmax(130px, 1fr))',
211225
gap: 2,
212226
},
227+
opacity: forceTheme ? 0.5 : 1,
228+
pointerEvents: forceTheme ? 'none' : 'auto',
213229
}}
214230
>
215231
{appThemes.map(it => (
216232
<Box
217233
key={it.name}
218234
role="button"
219-
tabIndex={0}
235+
tabIndex={forceTheme ? -1 : 0}
220236
onKeyDown={e => {
221237
if (e.key === 'Enter' || e.key === ' ') dispatch(setTheme(it.name));
222238
}}
223239
sx={{
224-
cursor: 'pointer',
240+
cursor: forceTheme ? 'not-allowed' : 'pointer',
225241
border: themeName === it.name ? '2px solid' : '1px solid',
226242
borderColor: themeName === it.name ? 'primary' : 'divider',
227243
borderRadius: 2,
@@ -231,10 +247,10 @@ export default function Settings() {
231247
alignItems: 'center',
232248
transition: '0.2 ease',
233249
'&:hover': {
234-
backgroundColor: 'divider',
250+
backgroundColor: forceTheme ? 'transparent' : 'divider',
235251
},
236252
}}
237-
onClick={() => dispatch(setTheme(it.name))}
253+
onClick={() => !forceTheme && dispatch(setTheme(it.name))}
238254
>
239255
<ThemePreview theme={it} size={110} />
240256
<Box sx={{ mt: 1 }}>{capitalize(it.name)}</Box>

frontend/src/i18n/locales/de/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "Design",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "Cluster-Einstellungen",
145146
"There seem to be no clusters configured…": "",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "",

frontend/src/i18n/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "Sort sidebar items alphabetically",
142142
"Use evict for pod deletion": "Use evict for pod deletion",
143143
"Theme": "Theme",
144+
"Theme has been forced by your administrator": "Theme has been forced by your administrator",
144145
"Cluster Settings": "Cluster Settings",
145146
"There seem to be no clusters configured…": "There seem to be no clusters configured…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "Cluster {{ clusterName }} does not exist. Please select a valid cluster:",

frontend/src/i18n/locales/es/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "Tema",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "Configuración del cluster",
145146
"There seem to be no clusters configured…": "No parece haber clusters configurados…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "El cluster {{ clusterName }} no existe. Por favor seleccione un cluster válido:",

frontend/src/i18n/locales/fr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "Thème",
144+
"Theme has been forced by your administrator": "Le thème est imposé par votre administrateur",
144145
"Cluster Settings": "Paramètres du cluster",
145146
"There seem to be no clusters configured…": "",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "",

frontend/src/i18n/locales/hi/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "साइडबार आइटमों को वर्णानुक्रम में सॉर्ट करें",
142142
"Use evict for pod deletion": "Pod हटाने के लिए निष्कासन का उपयोग करें",
143143
"Theme": "थीम",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "क्लस्टर सेटिंग्स",
145146
"There seem to be no clusters configured…": "ऐसा लगता है कि कोई क्लस्टर कॉन्फ़िगर नहीं किया गया है…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "क्लस्टर {{ clusterName }} मौजूद नहीं है। कृपया वैध क्लस्टर चुनें:",

frontend/src/i18n/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "Tema",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "Impostazioni Cluster",
145146
"There seem to be no clusters configured…": "Sembra che non ci siano cluster configurati…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "Il cluster {{ clusterName }} non esiste. Seleziona un cluster valido:",

frontend/src/i18n/locales/ja/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "テーマ",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "クラスター設定",
145146
"There seem to be no clusters configured…": "設定されたクラスターがないようです...",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "クラスター {{ clusterName }} は存在しません。有効なクラスターを選択してください:",

frontend/src/i18n/locales/ko/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "사이드바 항목을 가나다순으로 정렬",
142142
"Use evict for pod deletion": "",
143143
"Theme": "테마",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "클러스터 설정",
145146
"There seem to be no clusters configured…": "설정된 클러스터가 없는 것 같습니다…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "클러스터 {{ clusterName }} 가 존재하지 않습니다. 유효한 클러스터를 선택하세요:",

frontend/src/i18n/locales/pt/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"Sort sidebar items alphabetically": "",
142142
"Use evict for pod deletion": "",
143143
"Theme": "Tema",
144+
"Theme has been forced by your administrator": "",
144145
"Cluster Settings": "Definições do Cluster",
145146
"There seem to be no clusters configured…": "Parece não haver clusters configurados…",
146147
"Cluster {{ clusterName }} does not exist. Please select a valid cluster:": "O cluster {{ clusterName }} não existe. Por favor, selecione um cluster válido:",

0 commit comments

Comments
 (0)