Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: responsive account settings + settings page #2958

Merged
merged 8 commits into from
Feb 29, 2024
14 changes: 11 additions & 3 deletions src/app/components/Setting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import { classNames } from "~/app/utils";

type Props = {
title: string;
subtitle: string | React.ReactNode;
children: React.ReactNode;
inline?: boolean;
pavanjoshi914 marked this conversation as resolved.
Show resolved Hide resolved
};

function Setting({ title, subtitle, children }: Props) {
function Setting({ title, subtitle, children, inline }: Props) {
return (
<div className="py-4 flex justify-between items-center">
<div
className={classNames(
inline ? "" : "flex-col sm:flex-row",
"flex justify-between py-4"
)}
>
<div>
<span className="text-black dark:text-white font-medium">{title}</span>
<p className="text-gray-600 mr-1 dark:text-neutral-400 text-sm">
{subtitle}
</p>
</div>
{children}
<div className="flex items-center">{children}</div>
</div>
);
}
Expand Down
42 changes: 21 additions & 21 deletions src/app/screens/Accounts/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ function AccountDetail() {
updatedAccount.name = accountName;
setAccount(updatedAccount);
}}
className="flex justify-between items-end"
className="flex flex-col sm:flex-row justify-between items-center"
>
<div className="w-7/12">
<div className="sm:w-7/12 w-full">
<TextField
id="name"
label={t("name.title")}
Expand All @@ -204,7 +204,7 @@ function AccountDetail() {
/>
</div>
<div className="w-1/5 flex-none mx-4 d-none"></div>
<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
<Button
type="submit"
label={tCommon("actions.save")}
Expand All @@ -217,8 +217,8 @@ function AccountDetail() {
{account.connectorType == "lndhub" && (
<>
<MenuDivider />
<div className="flex justify-between items-end">
<div className="w-9/12">
<div className="flex flex-col sm:flex-row justify-between items-center">
<div className="sm:w-9/12 w-full">
<p className="text-black dark:text-white font-medium">
{t("export.title")}
</p>
Expand All @@ -244,7 +244,7 @@ function AccountDetail() {
</p>
</div>

<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
{exportAccount && account.connectorType === "lndhub" && (
<>
<Button
Expand Down Expand Up @@ -316,8 +316,8 @@ function AccountDetail() {
<Alert type="warn">{t("mnemonic.backup.warning")}</Alert>
)}

<div className="flex justify-between items-end">
<div className="w-9/12">
<div className="flex flex-col sm:flex-row justify-between items-center">
<div className="sm:w-9/12 w-full">
<p className="text-black dark:text-white font-medium">
{t(
hasMnemonic
Expand All @@ -334,7 +334,7 @@ function AccountDetail() {
</p>
</div>

<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
<Link to={`secret-key/${hasMnemonic ? "backup" : "new"}`}>
<Button
label={t(
Expand All @@ -351,8 +351,8 @@ function AccountDetail() {
{!hasMnemonic && (
<>
<MenuDivider />
<div className="flex justify-between items-end">
<div className="w-7/12">
<div className="flex flex-col sm:flex-row justify-between items-center">
<div className="sm:w-7/12 w-full">
<p className="text-black dark:text-white font-medium">
{t("mnemonic.import.title")}
</p>
Expand All @@ -361,7 +361,7 @@ function AccountDetail() {
</p>
</div>

<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
<Link to="secret-key/import">
<Button
label={t("mnemonic.import.button")}
Expand All @@ -374,8 +374,8 @@ function AccountDetail() {
</>
)}
<MenuDivider />
<div className="flex justify-between items-center">
<div className="w-7/12">
<div className="flex flex-col sm:flex-row justify-between items-center">
<div className="sm:w-7/12 w-full">
<div className="flex flex-col">
<TextField
id="nostrPublicKey"
Expand All @@ -400,7 +400,7 @@ function AccountDetail() {
</div>
)}
</div>
<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
<Link to="nostr/settings">
<Button label={t("nostr.settings.label")} primary fullWidth />
</Link>
Expand Down Expand Up @@ -430,8 +430,8 @@ function AccountDetail() {
!hasMnemonic && "opacity-30"
)}
>
<div className="flex justify-between items-end">
<div className="w-7/12 flex flex-col gap-2">
<div className="flex flex-col sm:flex-row justify-between items-center">
<div className="sm:w-7/12 w-full flex flex-col gap-2">
<p className="text-black dark:text-white font-medium">
{t("network.title")}
</p>
Expand All @@ -440,7 +440,7 @@ function AccountDetail() {
</p>
</div>

<div className="w-1/5 flex-none">
<div className="flex-none sm:w-1/5 w-full pt-4 sm:pt-0">
<Select
name="network"
value={account.bitcoinNetwork}
Expand Down Expand Up @@ -470,7 +470,7 @@ function AccountDetail() {
</div>
</div>
<MenuDivider />
<div className="flex justify-between items-end">
<div className="flex justify-between items-center">
<div className="w-7/12 flex flex-col gap-2">
<p className="text-black dark:text-white font-medium">
{t("mnemonic.lnurl.title")}
Expand Down Expand Up @@ -515,7 +515,7 @@ function AccountDetail() {
title={t("remove_secretkey.title")}
subtitle={t("remove_secretkey.subtitle")}
>
<div className="w-64">
<div className="sm:w-64 flex-none w-full pt-4 sm:pt-0">
<Button
onClick={() => {
removeMnemonic({
Expand All @@ -530,7 +530,7 @@ function AccountDetail() {
</Setting>
)}
<Setting title={t("remove.title")} subtitle={t("remove.subtitle")}>
<div className="w-64">
<div className="sm:w-64 flex-none w-full pt-4 sm:pt-0">
<Button
onClick={() => {
removeAccount({
Expand Down
8 changes: 7 additions & 1 deletion src/app/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function Settings() {
<Setting
title={t("browser_notifications.title")}
subtitle={t("browser_notifications.subtitle")}
inline={true}
>
{!isLoading && (
<Toggle
Expand All @@ -83,6 +84,7 @@ function Settings() {
<Setting
title={t("website_enhancements.title")}
subtitle={t("website_enhancements.subtitle")}
inline={true}
>
{!isLoading && (
<Toggle
Expand All @@ -102,6 +104,7 @@ function Settings() {
{!cameraPermissionsGranted ? (
<Button
label={t("camera_access.allow")}
className="sm:w-64 flex-none w-full pt-4 sm:pt-0"
onClick={async () => {
try {
await Html5Qrcode.getCameras();
Expand Down Expand Up @@ -141,7 +144,7 @@ function Settings() {
</Setting>
<Setting title={t("theme.title")} subtitle={t("theme.subtitle")}>
{!isLoading && (
<div className="w-64">
<div className="sm:w-64 flex-none w-full pt-4 sm:pt-0">
<Select
name="theme"
value={settings.theme}
Expand Down Expand Up @@ -182,6 +185,7 @@ function Settings() {
<Setting
title={t("show_fiat.title")}
subtitle={t("show_fiat.subtitle")}
inline={true}
>
{!isLoading && (
<Toggle
Expand Down Expand Up @@ -383,6 +387,7 @@ function Settings() {
<Setting
title={t("lnurl_auth.legacy_lnurl_auth_202207.title")}
subtitle={t("lnurl_auth.legacy_lnurl_auth_202207.subtitle")}
inline={true}
>
{!isLoading && (
<Toggle
Expand All @@ -400,6 +405,7 @@ function Settings() {
<Setting
title={t("lnurl_auth.legacy_lnurl_auth.title")}
subtitle={t("lnurl_auth.legacy_lnurl_auth.subtitle")}
inline={true}
>
{!isLoading && (
<Toggle
Expand Down
Loading