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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c13n-arc",
"homepage": "https://c13n-io.github.io/arc/",
"homepage": "./",
"version": "0.0.2",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/content-pages/chat-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ const ChatHistory = (props) => {
<p className="chat-history-feeModal-text">Received by you</p>
<Button
className="chat-history-feeModal-button"
type="default"
type="secondary"
onClick={() => {
setRawMessageInfoModalVisible(true);
}}
Expand Down
73 changes: 23 additions & 50 deletions src/components/content-pages/user-settings.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import React, { useState } from "react";
import { Button, Form, Divider, Switch, Select, Collapse } from "antd";
import { LogoutOutlined } from "@ant-design/icons";
import { GithubPicker } from "react-color";
import "./user-settings.css";
import theme from "../../style/theme";
import { DoubleRightOutlined } from "@ant-design/icons";

import {
saveAutomaticImageLoadingSetting,
saveSmoothAnimationsSetting,
saveSelectedCryptoUnit,
saveSelectedFiatUnit,
saveChatIdenticonsSetting,
saveChatLayoutSetting,
saveMyMessageColor,
saveOtherMessageColor,
saveDeveloperLogsSetting,
} from "../../utils/settings";

const messageColorsArray = [
"black",
"darkslategray",
Expand Down Expand Up @@ -69,11 +80,7 @@ const UserSettings = (props) => {
checked={!!props.automaticImageLoading}
className="user-settings-collapse"
onChange={(value) => {
props.setAutomaticImageLoading(value);
window.localStorage.setItem(
"automaticImageLoadingSetting",
value
);
saveAutomaticImageLoadingSetting(props.setAutomaticImageLoading, value);
}}
/>
Allow automatic loading of externally linked images
Expand All @@ -83,11 +90,7 @@ const UserSettings = (props) => {
checked={!!props.smoothAnimations}
className="user-settings-collapse"
onChange={(value) => {
props.setSmoothAnimations(value);
window.localStorage.setItem(
"smoothAnimationsSetting",
value
);
saveSmoothAnimationsSetting(props.setSmoothAnimations, value);
}}
/>
Enable smooth animations and transitions
Expand All @@ -97,11 +100,7 @@ const UserSettings = (props) => {
checked={!!props.chatIdenticons}
className="user-settings-collapse"
onChange={(value) => {
props.setChatIdenticons(value);
window.localStorage.setItem(
"chatIdenticonsSetting",
value
);
saveChatIdenticonsSetting(props.setChatIdenticons, value);
}}
/>
Show user icons in chat messages
Expand All @@ -111,8 +110,7 @@ const UserSettings = (props) => {
defaultValue={`${props.chatLayout}`}
className="user-settings-formSelect"
onChange={(e) => {
props.setChatLayout(e);
window.localStorage.setItem("chatLayoutSetting", e);
saveChatLayoutSetting(props.setChatLayout, e);
}}
>
<Select.Option value="normal">Normal</Select.Option>
Expand All @@ -129,20 +127,12 @@ const UserSettings = (props) => {
colors={messageColorsArray}
color={props.myMessageColor}
onChangeComplete={(color) => {
props.setMyMessageColor(color.hex);
window.localStorage.setItem(
"myMessageColorSetting",
color.hex
);
saveMyMessageColor(props.setMyMessageColor, color.hex);
}}
/>
<Button
onClick={() => {
props.setMyMessageColor("rgba(0, 0, 0, 0.0)");
window.localStorage.setItem(
"myMessageColorSetting",
"rgba(0, 0, 0, 0.0)"
);
saveMyMessageColor(props.setMyMessageColor, "rgba(0, 0, 0, 0.0)");
}}
>
Transparent
Expand All @@ -156,20 +146,12 @@ const UserSettings = (props) => {
colors={messageColorsArray}
color={props.myMessageColor}
onChangeComplete={(color) => {
props.setOtherMessageColor(color.hex);
window.localStorage.setItem(
"otherMessageColorSetting",
color.hex
);
saveOtherMessageColor(props.setOtherMessageColor, color.hex);
}}
/>
<Button
onClick={() => {
props.setOtherMessageColor("rgba(0, 0, 0, 0.0)");
window.localStorage.setItem(
"otherMessageColorSetting",
"rgba(0, 0, 0, 0.0)"
);
saveOtherMessageColor(props.setOtherMessageColor, "rgba(0, 0, 0, 0.0)");
}}
>
Transparent
Expand All @@ -180,11 +162,7 @@ const UserSettings = (props) => {
checked={!!props.developerLogs}
className="user-settings-collapse"
onChange={(value) => {
props.setDeveloperLogs(value);
window.localStorage.setItem(
"developerLogsSetting",
value
);
saveDeveloperLogsSetting(props.setDeveloperLogs, value);
}}
/>
Developer Logs (Page refresh required)
Expand All @@ -196,11 +174,7 @@ const UserSettings = (props) => {
defaultValue={`${props.selectedCryptoUnit}`}
className="user-settings-formSelect"
onChange={(e) => {
props.setSelectedCryptoUnit(e);
window.localStorage.setItem(
"selectedCryptoUnitSetting",
e
);
saveSelectedCryptoUnit(props.setSelectedCryptoUnit, e);
}}
>
<Select.Option value="mBTC">mBTC</Select.Option>
Expand All @@ -214,8 +188,7 @@ const UserSettings = (props) => {
defaultValue={`${props.selectedFiatUnit}`}
className="user-settings-formSelect"
onChange={(e) => {
props.setSelectedFiatUnit(e);
window.localStorage.setItem("selectedFiatUnitSetting", e);
setSelectedFiatUnit(props.setSelectedFiatUnit, e);
}}
>
<Select.Option value="EUR">EUR</Select.Option>
Expand Down
3 changes: 0 additions & 3 deletions src/payload-protocol/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ import c13nLinkRef from "../components/content-pages/markdown/c13n-link-ref";
import c13nText from "../components/content-pages/markdown/c13n-text";
import c13nInlineCode from "../components/content-pages/markdown/c13n-inline-code";

import ChatHistoryImage from "../components/content-pages/chat-history-image";

import { issuePayreq, checkPayreq, satisfyPayreq } from "../utils/payreq/payreq-tracker";

import { Button, List } from "antd";
import { CheckOutlined } from "@ant-design/icons";

import { downloadImage, cachedImages } from "../utils/lsat/download-image";
import React from "react";
import { sendPayreqPay } from "../utils/payreq/utils";

Expand Down
57 changes: 56 additions & 1 deletion src/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ const loadAutomaticImageLoadingSetting = (setAutomaticImageLoading) => {
setAutomaticImageLoading(res !== 'false');
};

const saveAutomaticImageLoadingSetting = (setAutomaticImageLoading, value) => {
window.localStorage.setItem('automaticImageLoadingSetting', value);
setAutomaticImageLoading(value);
};

const loadSmoothAnimationsSetting = (setSmoothAnimations) => {
let res = window.localStorage.getItem('smoothAnimationsSetting');
setSmoothAnimations(res !== 'false');
};

const saveSmoothAnimationsSetting = (setSmoothAnimations, value) => {
window.localStorage.setItem('smoothAnimationsSetting', value);
setSmoothAnimations(value);
};

const loadSelectedCryptoUnit = (setSelectedCryptoUnit) => {
let res = window.localStorage.getItem('selectedCryptoUnitSetting');
if (res === 'sat' || res === 'msat' || res === 'mBTC') {
Expand All @@ -17,6 +27,11 @@ const loadSelectedCryptoUnit = (setSelectedCryptoUnit) => {
}
};

const saveSelectedCryptoUnit = (setSelectedCryptoUnit, value) => {
window.localStorage.setItem('selectedCryptoUnitSetting', value);
setSelectedCryptoUnit(value);
};

const loadSelectedFiatUnit = (setSelectedFiatUnit) => {
let res = window.localStorage.getItem('selectedFiatUnitSetting');
if (res === 'EUR' || res === 'USD') {
Expand All @@ -26,11 +41,21 @@ const loadSelectedFiatUnit = (setSelectedFiatUnit) => {
}
};

const saveSelectedFiatUnit = (setSelectedFiatUnit, value) => {
window.localStorage.setItem('selectedFiatUnitSetting', value);
setSelectedFiatUnit(value);
};

const loadChatIdenticonsSetting = (setChatIdenticons) => {
let res = window.localStorage.getItem('chatIdenticonsSetting');
setChatIdenticons(res !== 'false');
};

const saveChatIdenticonsSetting = (setChatIdenticons, value) => {
window.localStorage.setItem('chatIdenticonsSetting', value);
setChatIdenticons(value);
};

const loadChatLayoutSetting = (setChatLayout) => {
let res = window.localStorage.getItem('chatLayoutSetting');
if (res === 'normal' || res === 'left' || res === 'right') {
Expand All @@ -40,6 +65,11 @@ const loadChatLayoutSetting = (setChatLayout) => {
}
};

const saveChatLayoutSetting = (setChatLayout, value) => {
window.localStorage.setItem('chatLayoutSetting', value);
setChatLayout(value);
};

const loadMyMessageColor = (setMyMessageColor) => {
let res = window.localStorage.getItem('myMessageColorSetting');
if(res !== 'undefined' && res !== undefined && res !== null) {
Expand All @@ -49,6 +79,11 @@ const loadMyMessageColor = (setMyMessageColor) => {
}
};

const saveMyMessageColor = (setMyMessageColor, value) => {
window.localStorage.setItem('myMessageColorSetting', value);
setMyMessageColor(value);
};

const loadOtherMessageColor = (setOtherMessageColor) => {
let res = window.localStorage.getItem('otherMessageColorSetting');
if(res !== 'undefined' && res !== undefined && res !== null) {
Expand All @@ -58,6 +93,11 @@ const loadOtherMessageColor = (setOtherMessageColor) => {
}
};

const saveOtherMessageColor = (setOtherMessageColor, value) => {
window.localStorage.setItem('otherMessageColorSetting', value);
setOtherMessageColor(value);
};

const loadDeveloperLogsSetting = (setDeveloperLogs) => {
let res = window.localStorage.getItem('developerLogsSetting');
setDeveloperLogs(res === 'true');
Expand All @@ -67,6 +107,12 @@ const loadDeveloperLogsSetting = (setDeveloperLogs) => {
}
};

const saveDeveloperLogsSetting = (setDeveloperLogs, value) => {
window.localStorage.setItem('developerLogsSetting', value);
setDeveloperLogs(value);
};


export {
loadAutomaticImageLoadingSetting,
loadSmoothAnimationsSetting,
Expand All @@ -76,5 +122,14 @@ export {
loadChatLayoutSetting,
loadMyMessageColor,
loadOtherMessageColor,
loadDeveloperLogsSetting
loadDeveloperLogsSetting,
saveAutomaticImageLoadingSetting,
saveSmoothAnimationsSetting,
saveSelectedCryptoUnit,
saveSelectedFiatUnit,
saveChatIdenticonsSetting,
saveChatLayoutSetting,
saveMyMessageColor,
saveOtherMessageColor,
saveDeveloperLogsSetting
};