From 8de95a5d60dea81b3edcff87c47262cfd8814498 Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Mon, 5 Feb 2024 15:51:20 +0100 Subject: [PATCH] Fix QR and zapping --- src/components/QrCode/QrCode.module.scss | 2 +- src/components/QrCode/QrCode.tsx | 8 +- src/pages/Profile.tsx | 339 +++++++++++------------ src/translations.ts | 7 + 4 files changed, 176 insertions(+), 180 deletions(-) diff --git a/src/components/QrCode/QrCode.module.scss b/src/components/QrCode/QrCode.module.scss index b454886..ca8a06a 100644 --- a/src/components/QrCode/QrCode.module.scss +++ b/src/components/QrCode/QrCode.module.scss @@ -6,7 +6,7 @@ .frame { width: 280px; height: 280px; - border-radius: 24px; + border-radius: 12px; overflow: hidden; } } diff --git a/src/components/QrCode/QrCode.tsx b/src/components/QrCode/QrCode.tsx index 6c19430..74f85c2 100644 --- a/src/components/QrCode/QrCode.tsx +++ b/src/components/QrCode/QrCode.tsx @@ -31,18 +31,18 @@ const QrCode: Component<{ data: string }> = (props) => { imageOptions: { hideBackgroundDots: true, imageSize:0.2, - margin:0, + margin: 4, }, dotsOptions:{ - type: "square", + type: "rounded", color: 'black', }, cornersSquareOptions: { - type: "square", + type: 'extra-rounded' , color: 'black', }, cornersDotOptions: { - type: "square", + type: 'square', color: 'black', }, backgroundOptions: { diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 130fe6f..bcbecc7 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -12,7 +12,7 @@ import { } from 'solid-js'; import Avatar from '../components/Avatar/Avatar'; import { hexToNpub } from '../lib/keys'; -import { nip05Verification, truncateNpub, userName } from '../stores/profile'; +import { authorName, nip05Verification, truncateNpub, userName } from '../stores/profile'; import { useToastContext } from '../components/Toaster/Toaster'; import { useSettingsContext } from '../contexts/SettingsContext'; import { useProfileContext } from '../contexts/ProfileContext'; @@ -25,26 +25,23 @@ import { shortDate } from '../lib/dates'; import styles from './Profile.module.scss'; import StickySidebar from '../components/StickySidebar/StickySidebar'; import ProfileSidebar from '../components/ProfileSidebar/ProfileSidebar'; -import { MenuItem, PrimalUser, VanityProfiles, ZapOption } from '../types/primal'; +import { MenuItem, VanityProfiles, ZapOption } from '../types/primal'; import PageTitle from '../components/PageTitle/PageTitle'; import FollowButton from '../components/FollowButton/FollowButton'; import Search from '../components/Search/Search'; import { useMediaContext } from '../contexts/MediaContext'; -import { profile as t, actions as tActions, toast as tToast, feedProfile } from '../translations'; +import { profile as t, actions as tActions, toast as tToast, feedProfile, toastZapProfile } from '../translations'; import PrimalMenu from '../components/PrimalMenu/PrimalMenu'; import ConfirmModal from '../components/ConfirmModal/ConfirmModal'; import { isAccountVerified, reportUser } from '../lib/profile'; import { APP_ID } from '../App'; import ProfileTabs from '../components/ProfileTabs/ProfileTabs'; -import ButtonCopy from '../components/Buttons/ButtonCopy'; import ButtonSecondary from '../components/Buttons/ButtonSecondary'; import VerificationCheck from '../components/VerificationCheck/VerificationCheck'; import PhotoSwipeLightbox from 'photoswipe/lightbox'; import NoteImage from '../components/NoteImage/NoteImage'; -import { createStore } from 'solid-js/store'; import CustomZap from '../components/CustomZap/CustomZap'; -import Modal from '../components/Modal/Modal'; import ProfileQrCodeModal from '../components/ProfileQrCodeModal/ProfileQrCodeModal'; const Profile: Component = () => { @@ -507,192 +504,184 @@ const Profile: Component = () => { +
+
+
} + > + + +
-
-
-
} +
+
+
+ +
+
+
+ +
+
+ - - -
- -
-
-
- -
-
-
- -
-
- -
-
-
- setOpenQr(true)} - shrink={true} - > -
-
- - setOpenQr(false)} - profile={profile?.userProfile} +
+ +
- -
- setOpenQr(true)} + shrink={true} > -
-
- {profileName()} - - - - -
- {intl.formatMessage(t.followsYou)} -
-
+
+ -
+ setOpenQr(false)} + profile={profile?.userProfile} + /> - -
- {intl.formatMessage( - t.jointDate, - { - date: shortDate(profile?.userStats.time_joined), - }, - )} -
-
-
+ + setIsCustomZap(true)} + shrink={true} + > +
+
-
- -
-
{nip05Verification(profile?.userProfile)}
-
-
-
- -
-
- -
-
- - 0}> -
-
+ { + setIsCustomZap(false); + }} + onSuccess={(zapOption: ZapOption) => { + setIsCustomZap(false); + toaster?.sendSuccess(intl.formatMessage(toastZapProfile, { + name: authorName(profile?.userProfile) + })) + }} + onFail={(zapOption: ZapOption) => { + setIsCustomZap(false); + }} + onCancel={(zapOption: ZapOption) => { + setIsCustomZap(false); + }} + />
+ + navigate(`/messages/${profile?.userProfile?.npub}`)} + shrink={true} + > +
+
+
- -
- + + + +
+ navigate('/settings/profile')} + title={intl.formatMessage(tActions.editProfile)} + > +
{intl.formatMessage(tActions.editProfile)}
+
- +
+ +
+
+ {profileName()} + + + + +
+ {intl.formatMessage(t.followsYou)} +
+
- { - doReportUser(); - setConfirmReportUser(false); - }} - onAbort={() => setConfirmReportUser(false)} - /> +
- { - doMuteUser(); - setConfirmMuteUser(false); - }} - onAbort={() => setConfirmMuteUser(false)} - /> + +
+ {intl.formatMessage( + t.jointDate, + { + date: shortDate(profile?.userStats.time_joined), + }, + )} +
+
+
+ +
+ +
+
{nip05Verification(profile?.userProfile)}
+
+
+
+ +
+
+ + 0}> +
+
+
+ + + + + +
+ + + + { + doReportUser(); + setConfirmReportUser(false); + }} + onAbort={() => setConfirmReportUser(false)} + /> + + { + doMuteUser(); + setConfirmMuteUser(false); + }} + onAbort={() => setConfirmMuteUser(false)} + /> ) } diff --git a/src/translations.ts b/src/translations.ts index 6c4259a..153f3a8 100644 --- a/src/translations.ts +++ b/src/translations.ts @@ -1748,6 +1748,13 @@ export const toastZapFail = { description: 'Toast message indicating failed zap', }; + +export const toastZapProfile = { + id: 'toast.zapProfile', + defaultMessage: '{name} zapped successfully', + description: 'Toast message indicating successful zap', +}; + export const thread = { sidebar: { id: 'thread.sidebar.title',