Skip to content

Commit

Permalink
remove accent colors and add error print to terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed May 15, 2024
1 parent da351c1 commit 927112d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 275 deletions.
13 changes: 0 additions & 13 deletions Website/src/activitys/MainActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import UnverifiedHostActivity from "./UnverifiedHostActivity";
import { useModFS } from "@Hooks/useModFS";
import { SuFile } from "@Native/SuFile";
import { LogcatActivity } from "./LogcatActivity";
import { view } from "@Native/View";

const getLocation = () => {
if (window.location !== window.parent.location) {
Expand Down Expand Up @@ -285,18 +284,6 @@ const MainActivity = (): JSX.Element => {
<Splitter>
<Splitter.Side
side="left"
sx={{
borderColor: theme.palette.menuoutline,
borderStyle: "solid",
borderLeft: "0px",
borderWidth: "1px",
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
mt: `calc(${view.getWindowTopInsets() || 8}px + 0.5% - 2px)`,
mb: `calc(${view.getWindowBottomInsets() || 8}px + 0.5% - 2px)`,
".page--material": {
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
},
}}
width={250}
collapse={true}
swipeable={false}
Expand Down
10 changes: 10 additions & 0 deletions Website/src/activitys/SettingsActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ function SettingsActivity() {
checked={settings.term_scroll_bottom}
/>
</ListItem>
<ListItem>
<ListItemText primary={strings("print_errors")} secondary={strings("print_errors_desc")} />
<Switch
edge="end"
onChange={(e) => {
setSettings("term_scroll_bottom", e.target.checked);
}}
checked={settings.term_scroll_bottom}
/>
</ListItem>
<ListPickerItem
id="term-scroll-behavior"
targetSetting="term_scroll_behavior"
Expand Down
2 changes: 2 additions & 0 deletions Website/src/activitys/TerminalActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const TerminalActivity = () => {
}),
cwd: "/data/local/tmp",
env: envp_explore,
printError: settings.print_terminal_error,
onLine: (line) => {
if (line.startsWith("#!mmrl:")) {
processCommand(line.substring(7));
Expand Down Expand Up @@ -234,6 +235,7 @@ const TerminalActivity = () => {
ZIPFILE: path,
}),
env: envp_local,
printError: settings.print_terminal_error,
cwd: "/data/local/tmp",
onLine: (line) => {
if (line.startsWith("#!mmrl:")) {
Expand Down
1 change: 0 additions & 1 deletion Website/src/components/DialogEditTextListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface DialogEditTextListItemProps extends React.PropsWithChildren {

export const DialogEditTextListItem = (props: DialogEditTextListItemProps) => {
const { strings } = useStrings();
const { scheme, shade } = useTheme();

const [textInput, setTextInput] = React.useState(props.initialValue);
const [open, setOpen] = React.useState(false);
Expand Down
2 changes: 1 addition & 1 deletion Website/src/components/ListPickerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface PickerItemProps {
id: string;
disabled?: boolean;
contentMap: ContentMap[];
targetSetting: "language" | "accent_scheme" | "term_scroll_behavior";
targetSetting: "language" | "term_scroll_behavior";
title: React.ReactNode;
}

Expand Down
2 changes: 1 addition & 1 deletion Website/src/components/Markdown/StyledMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
}

export const StyledMarkdown = styled("article")(() => {
const { theme, scheme, shade } = useTheme();
const { theme } = useTheme();
const { settings } = useSettings();

return {
Expand Down
10 changes: 2 additions & 8 deletions Website/src/hooks/useModulesFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface FilterDialogProps {
}

export const FilterDialog = (props: FilterDialogProps) => {
const { scheme, theme } = useTheme();
const { theme } = useTheme();
const { onClose, selectedValue, open } = props;

const handleClose = () => {
Expand All @@ -106,13 +106,7 @@ export const FilterDialog = (props: FilterDialogProps) => {
<ListItem disableGutters key={filter.value}>
<ListItemButton onClick={() => handleListItemClick(filter.value)}>
<ListItemAvatar>
<Avatar
sx={{
bgcolor: scheme[100],
color: scheme[600],
border: filter.value === selectedValue ? `2px solid ${scheme[600]}` : "unset",
}}
>
<Avatar>
<filter.icon />
</Avatar>
</ListItemAvatar>
Expand Down
149 changes: 3 additions & 146 deletions Website/src/hooks/useSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,152 +1,9 @@
import React, { createContext, useContext } from "react";
import { colors as kolors } from "@mui/material";
import { defaultComposer } from "default-composer";
import { os } from "@Native/Os";
import { SetStateAction } from "./useStateCallback";
import { useLanguageMap } from "./../locales/declaration";
import { useNativeStorage } from "./useNativeStorage";
import { useNativeFileStorage } from "./useNativeFileStorage";

export const accent_colors: Picker<string, any>[] = [
{
name: "Purple",
value: "purple",
},
{
name: "Amber",
value: "amber",
},
{
name: "Blue",
value: "blue",
},
{
name: "Blue & Grey",
value: "blueGrey",
},
{
name: "Dark & Grey",
value: "darkGrey",
},
{
name: "Cyan",
value: "cyan",
},
{
name: "Deep Orange",
value: "deepOrange",
},

{
name: "Deep Purple",
value: "deepPurple",
},
{
name: "Green",
value: "green",
},
{
name: "Indigo",
value: "indigo",
},
{
name: "Light Blue",
value: "lightBlue",
},

{
name: "Light Green",
value: "lightGreen",
},
{
name: "Lime",
value: "lime",
},
{
name: "Orange",
value: "orange",
},
{
name: "Pink",
value: "pink",
},

{
name: "Red",
value: "red",
},
{
name: "Teal",
value: "teal",
},
{
name: "Yellow",
value: "yellow",
},
// Only load if it is android platform and above android 12
...(os.isAndroid
? os.sdk >= 31
? [
{
name: "Monet (Android 12+)",
value: "monet",
},
]
: []
: []),
];

const monet = {
50: os.getMonetColor("system_accent2_50"),
100: os.getMonetColor("system_accent2_100"),
200: os.getMonetColor("system_accent2_200"),
300: os.getMonetColor("system_accent2_300"),
400: os.getMonetColor("system_accent2_400"),
500: os.getMonetColor("system_accent2_500"),
600: os.getMonetColor("system_accent2_600"),
700: os.getMonetColor("system_accent2_700"),
800: os.getMonetColor("system_accent2_800"),
900: os.getMonetColor("system_accent2_900"),
};

const darkGrey = {
50: "#bcc8d4",
100: "#a9b4be",
200: "#96a0a9",
300: "#838c94",
400: "#70787f",
500: "#5e646a",
600: "#4b5054",
700: "#383c3f",
800: "#25282a",
900: "#121415",
};

export const colors = {
amber: kolors.amber,
blue: kolors.blue,
blueGrey: kolors.blueGrey,
darkGrey: darkGrey,
brown: kolors.brown,
cyan: kolors.cyan,
deepOrange: kolors.deepOrange,
deepPurple: kolors.deepPurple,
green: kolors.green,
grey: kolors.grey,
indigo: kolors.indigo,
lightBlue: kolors.lightBlue,
lightGreen: kolors.lightGreen,
lime: kolors.lime,
orange: kolors.orange,
pink: kolors.pink,
purple: kolors.purple,
red: kolors.red,
teal: kolors.teal,
yellow: kolors.yellow,
// Only load if it is android platform and above android 12
...(os.isAndroid ? (os.sdk >= 31 ? { monet: monet } : {}) : {}),
};

export interface Picker<N, V> {
name: N;
value: V;
Expand All @@ -155,7 +12,6 @@ export interface Picker<N, V> {
export interface StorageDeclaration {
darkmode: boolean;
language: Picker<string, string>;
accent_scheme: Picker<string, any>;
eruda_console_enabled: boolean;
disabled_repos: string[];
_low_quality_module: boolean;
Expand All @@ -165,6 +21,7 @@ export interface StorageDeclaration {
term_scroll_behavior: { name: string; value: ScrollBehavior };
link_protection: boolean;
swipeable_tabs: boolean;
print_terminal_error: boolean;
}

export const termScrollBehaviors: StorageDeclaration["term_scroll_behavior"][] = [
Expand Down Expand Up @@ -210,7 +67,6 @@ export const SettingsProvider = (props: React.PropsWithChildren) => {
() => ({
darkmode: false,
language: availableLangs[0],
accent_scheme: accent_colors[0],
eruda_console_enabled: false,
disabled_repos: [],
_low_quality_module: true,
Expand All @@ -220,11 +76,12 @@ export const SettingsProvider = (props: React.PropsWithChildren) => {
term_scroll_behavior: termScrollBehaviors[0],
link_protection: true,
swipeable_tabs: false,
print_terminal_error: false,
}),
[]
);

const [settings, setSettings] = useNativeFileStorage("/data/adb/mmrl/settings.v1.json", INITIAL_SETTINGS, { loader: "json" });
const [settings, setSettings] = useNativeFileStorage("/data/adb/mmrl/settings.v2.json", INITIAL_SETTINGS, { loader: "json" });

const _setSettings = (name, state, callback) => {
setSettings(
Expand Down
34 changes: 0 additions & 34 deletions Website/src/hooks/useShadeColor.ts

This file was deleted.

Loading

0 comments on commit 927112d

Please sign in to comment.