diff --git a/front/components/GtkUI/ElementList.tsx b/front/components/GtkUI/ElementList.tsx
index 319ec3e..990a636 100644
--- a/front/components/GtkUI/ElementList.tsx
+++ b/front/components/GtkUI/ElementList.tsx
@@ -1,30 +1,25 @@
import React from "react";
import { StyleProp, ViewStyle } from "react-native";
-import IconButton from "../IconButton";
-import { Ionicons } from "@expo/vector-icons";
-import { RawElement } from "./RawElement";
import { Element } from "./Element";
+import {
+ ElementTextProps,
+ ElementToggleProps,
+ ElementDropdownProps,
+ ElementRangeProps,
+ ElementType,
+} from "./ElementTypes";
+
import {
Box,
- Center,
- Button,
Column,
- Row,
- Icon,
- Text,
Divider,
- Switch,
- Popover,
- Pressable,
- useBreakpointValue,
- Select,
} from "native-base";
export type ElementProps = {
title: string;
icon?: React.ReactNode;
- type?: ElementType | "custom";
+ type?: ElementType;
helperText?: string;
description?: string;
disabled?: boolean;
@@ -32,6 +27,7 @@ export type ElementProps = {
| ElementTextProps
| ElementToggleProps
| ElementDropdownProps
+ | ElementRangeProps
| React.ReactNode;
};
diff --git a/front/components/GtkUI/ElementTypes.tsx b/front/components/GtkUI/ElementTypes.tsx
index 61fad59..eeac1c2 100644
--- a/front/components/GtkUI/ElementTypes.tsx
+++ b/front/components/GtkUI/ElementTypes.tsx
@@ -1,6 +1,6 @@
-import { Select, Switch, Text, Icon, Row } from "native-base";
+import { Select, Switch, Text, Icon, Row, Slider } from "native-base";
import { MaterialIcons } from "@expo/vector-icons";
-export type ElementType = "custom" | "default" | "text" | "toggle" | "dropdown";
+export type ElementType = "custom" | "default" | "text" | "toggle" | "dropdown" | "range";
export type DropdownOption = {
label: string;
@@ -25,6 +25,15 @@ export type ElementDropdownProps = {
defaultValue?: string;
};
+export type ElementRangeProps = {
+ onValueChange: (value: number) => void;
+ value: number;
+ defaultValue?: number;
+ min: number;
+ max: number;
+ step?: number;
+}
+
export const getElementTextNode = (
{ text, onPress }: ElementTextProps,
disabled: boolean
@@ -92,3 +101,27 @@ export const getElementDropdownNode = (
);
};
+
+export const getElementRangeNode = (
+ { onValueChange, value, defaultValue, min, max, step }: ElementRangeProps,
+ disabled: boolean,
+ title: string,
+) => {
+ return (
+
+
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/front/components/GtkUI/RawElement.tsx b/front/components/GtkUI/RawElement.tsx
index cb92801..d4072b4 100644
--- a/front/components/GtkUI/RawElement.tsx
+++ b/front/components/GtkUI/RawElement.tsx
@@ -16,9 +16,11 @@ import {
getElementDropdownNode,
getElementTextNode,
getElementToggleNode,
+ getElementRangeNode,
ElementDropdownProps,
ElementTextProps,
ElementToggleProps,
+ ElementRangeProps
} from "./ElementTypes";
type RawElementProps = {
@@ -118,6 +120,12 @@ export const RawElement = ({ element, isHovered }: RawElementProps) => {
data as ElementDropdownProps,
disabled ?? false
);
+ case "range":
+ return getElementRangeNode(
+ data as ElementRangeProps,
+ disabled ?? false,
+ title
+ );
case "custom":
return data as React.ReactNode;
default:
diff --git a/front/views/settings/PreferencesView.tsx b/front/views/settings/PreferencesView.tsx
index 6bcd8dc..a942a3c 100644
--- a/front/views/settings/PreferencesView.tsx
+++ b/front/views/settings/PreferencesView.tsx
@@ -1,89 +1,94 @@
import React from 'react';
import { View } from 'react-native';
-import { useDispatch, useSelector } from 'react-redux';
+import { useDispatch } from 'react-redux';
import { Center, Button, Text, Switch, Slider, Select, Heading } from "native-base";
import { useLanguage } from "../../state/LanguageSlice";
-import i18n, { AvailableLanguages, DefaultLanguage, translate } from "../../i18n/i18n";
+import i18n, { AvailableLanguages, DefaultLanguage, translate, Translate } from "../../i18n/i18n";
+import { RootState, useSelector } from "../../state/Store";
+import { SettingsState, updateSettings } from "../../state/SettingsSlice";
const PreferencesView = ({navigation}) => {
- const dispatch = useDispatch();
- const language: AvailableLanguages = useSelector((state) => state.language.value);
+ const dispatch = useDispatch();
+ const language: AvailableLanguages = useSelector((state: RootState) => state.language.value);
+ const settings = useSelector((state: RootState) => (state.settings.settings as SettingsState));
+ return (
+
+
+
+
+
+
+
- return (
-
- { translate('prefBtn')}
+
+
+
-
+
+
+
-
-
-
+
+ Color blind mode
+ { dispatch(updateSettings({ colorBlind: enabled })) }}
+ />
+
-
-
-
+
+ Mic volume
+ { dispatch(updateSettings({ micLevel: value })) }}
+ >
+
+
+
+
+
+
-
-
-
-
-
- Color blind mode
-
-
-
-
- Mic volume
-
-
-
-
-
-
-
-
-
-
-
-
- )
+
+
+
+
+ )
}
export default PreferencesView;
\ No newline at end of file
diff --git a/front/views/settings/SettingsView.tsx b/front/views/settings/SettingsView.tsx
index 25fb676..0421b4d 100644
--- a/front/views/settings/SettingsView.tsx
+++ b/front/views/settings/SettingsView.tsx
@@ -16,6 +16,7 @@ import ChangeEmailForm from '../../components/forms/changeEmailForm';
import ProfileSettings from './SettingsProfileView';
import NotificationsView from './NotificationView';
import PrivacyView from './PrivacyView';
+import PreferencesView from './PreferencesView';
import API, { APIError } from '../../API';
@@ -76,90 +77,6 @@ const MainView = ({navigation}) => {
)
}
-export const PreferencesView = ({navigation}) => {
- const dispatch = useDispatch();
- const language: AvailableLanguages = useSelector((state: RootState) => state.language.value);
- const settings = useSelector((state: RootState) => (state.settings.settings as SettingsState));
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Color blind mode
- { dispatch(updateSettings({ colorBlind: enabled })) }}
- />
-
-
-
- Mic volume
- { dispatch(updateSettings({ micLevel: value })) }}
- >
-
-
-
-
-
-
-
-
-
-
-
- )
-}
-
export const ChangePasswordView = ({navigation}) => {
return (