Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 34f55b0

Browse files
committed
fix most of tony's problems
1 parent a9a7346 commit 34f55b0

15 files changed

Lines changed: 172 additions & 135 deletions

src/components/Activity.tsx

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { TagItem } from "@mutinywallet/mutiny-wasm";
2-
import { cache, createAsync, revalidate } from "@solidjs/router";
3-
import { Plus, Search, Shuffle } from "lucide-solid";
2+
import { cache, createAsync, revalidate, useNavigate } from "@solidjs/router";
3+
import { Plus, Save, Search, Shuffle } from "lucide-solid";
44
import { createEffect, createSignal, For, Match, Show, Switch } from "solid-js";
55

66
import {
77
ActivityDetailsModal,
8-
Card,
8+
ButtonCard,
99
HackActivityType,
1010
NiceP
1111
} from "~/components";
12+
import { useI18n } from "~/i18n/context";
1213
import { useMegaStore } from "~/state/megaStore";
1314
import { timeAgo } from "~/utils";
1415

@@ -145,10 +146,12 @@ export function UnifiedActivityItem(props: {
145146

146147
export function CombinedActivity() {
147148
const [state, _actions] = useMegaStore();
149+
const i18n = useI18n();
148150

149151
const [detailsOpen, setDetailsOpen] = createSignal(false);
150152
const [detailsKind, setDetailsKind] = createSignal<HackActivityType>();
151153
const [detailsId, setDetailsId] = createSignal("");
154+
const navigate = useNavigate();
152155

153156
function openDetailsModal(id: string, kind: HackActivityType) {
154157
console.log("Opening details modal: ", id, kind);
@@ -195,36 +198,40 @@ export function CombinedActivity() {
195198
</Show>
196199
<Switch>
197200
<Match when={activity().length === 0}>
198-
<Card>
199-
<NiceP>Welcome to the Mutiny.</NiceP>
200-
</Card>
201-
<Card>
202-
{/* <NiceP>TODO: copywriting lol</NiceP> */}
203-
<NiceP>
204-
<span>
205-
<Plus class="inline-block text-m-red" />
206-
</span>{" "}
207-
to receive your first sats.
208-
</NiceP>
209-
{/* <NiceP>
210-
{i18n.t(
211-
"activity.receive_some_sats_to_get_started"
212-
)}
213-
</NiceP> */}
214-
</Card>
215-
<Card>
216-
<NiceP>
217-
<span>
218-
<Search class="inline-block text-m-red" />
219-
</span>{" "}
220-
to find your friends on nostr.
221-
</NiceP>
222-
</Card>
223-
<Card>
224-
<NiceP>Don't forget to back up your seed words!</NiceP>
225-
</Card>
201+
<ButtonCard onClick={() => navigate("/receive")}>
202+
<div class="flex items-center gap-2">
203+
<Plus class="inline-block text-m-red" />
204+
<NiceP>{i18n.t("home.receive")}</NiceP>
205+
</div>
206+
</ButtonCard>
207+
<ButtonCard onClick={() => navigate("/search")}>
208+
<div class="flex items-center gap-2">
209+
<Search class="inline-block text-m-red" />
210+
<NiceP>{i18n.t("home.find")}</NiceP>
211+
</div>
212+
</ButtonCard>
213+
<Show when={!state.has_backed_up}>
214+
<ButtonCard
215+
onClick={() => navigate("/settings/backup")}
216+
>
217+
<div class="flex items-center gap-2">
218+
<Save class="inline-block text-m-red" />
219+
<NiceP>{i18n.t("home.backup")}</NiceP>
220+
</div>
221+
</ButtonCard>
222+
</Show>
226223
</Match>
227224
<Match when={activity().length >= 0}>
225+
<Show when={!state.has_backed_up}>
226+
<ButtonCard
227+
onClick={() => navigate("/settings/backup")}
228+
>
229+
<div class="flex items-center gap-2">
230+
<Save class="inline-block text-m-red" />
231+
<NiceP>{i18n.t("home.backup")}</NiceP>
232+
</div>
233+
</ButtonCard>
234+
</Show>
228235
<div class="flex w-full flex-col divide-y divide-m-grey-800 overflow-x-clip">
229236
<For each={activity()}>
230237
{(activityItem) => (

src/components/ActualSearch.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ export function ActualSearch(props: { initialValue?: string }) {
266266
</button>
267267
</Show>
268268
</div>
269-
{/* <Show when={!searchValue()}>
270-
<Suspense fallback={<LoadingShimmer />}>
271-
<MeOrEverybody />
272-
</Suspense>
273-
</Show> */}
274269
<Show when={searchState() !== "notsendable"}>
275270
<Button intent="green" onClick={handleContinue}>
276271
Continue

src/components/Fab.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ import { createSignal, JSX, onCleanup, onMount, Show } from "solid-js";
44

55
import { Circle } from "~/components";
66

7-
function FabMenuItem(props: { onClick: () => void; children: JSX.Element }) {
7+
function FabMenuItem(props: {
8+
onClick: () => void;
9+
disabled: boolean;
10+
children: JSX.Element;
11+
}) {
812
return (
9-
<button class="flex gap-2 px-2 py-4" onClick={() => props.onClick}>
13+
<button
14+
class="flex gap-2 px-2 py-4 disabled:opacity-50"
15+
disabled={props.disabled}
16+
onClick={() => props.onClick()}
17+
>
1018
{props.children}
1119
</button>
1220
);
@@ -61,8 +69,8 @@ export function Fab(props: { onSearch: () => void; onScan: () => void }) {
6169
<li>
6270
<FabMenuItem
6371
onClick={() => {
64-
setOpen(false);
6572
props.onSearch();
73+
setOpen(false);
6674
}}
6775
>
6876
<ArrowUpRight />
@@ -105,6 +113,7 @@ export function MiniFab(props: {
105113
onSend: () => void;
106114
onRequest: () => void;
107115
onScan: () => void;
116+
sendDisabled?: boolean | undefined;
108117
}) {
109118
const [open, setOpen] = createSignal(false);
110119
return (
@@ -114,9 +123,10 @@ export function MiniFab(props: {
114123
<ul class="flex flex-col divide-y divide-m-grey-400/25">
115124
<li>
116125
<FabMenuItem
126+
disabled={props.sendDisabled || false}
117127
onClick={() => {
118-
setOpen(false);
119128
props.onSend();
129+
setOpen(false);
120130
}}
121131
>
122132
<ArrowUpRight />
@@ -126,8 +136,8 @@ export function MiniFab(props: {
126136
<li>
127137
<FabMenuItem
128138
onClick={() => {
129-
setOpen(false);
130139
props.onRequest();
140+
setOpen(false);
131141
}}
132142
>
133143
<ArrowDownLeft />
@@ -138,8 +148,8 @@ export function MiniFab(props: {
138148
<li>
139149
<FabMenuItem
140150
onClick={() => {
141-
setOpen(false);
142151
props.onScan();
152+
setOpen(false);
143153
}}
144154
>
145155
<Scan />

src/components/GenericItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function GenericItem(props: {
9696
</Show>
9797
{/* OPTIONAL MESSAGE */}
9898
<Show when={props.message}>
99-
<div class="font-regular line-clamp-1 min-w-0 flex-shrink break-all rounded-full bg-m-grey-800 px-2 text-xs leading-6">
99+
<div class="font-regular line-clamp-1 min-w-0 break-all rounded-full bg-m-grey-800 px-2 py-1 text-xs leading-6">
100100
{props.message}
101101
</div>
102102
</Show>

src/components/HomeSubnav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function HomeSubnav() {
6363
}}
6464
onClick={() => setActiveView("everybody")}
6565
>
66-
Everybody
66+
Friends
6767
</button>
6868

6969
<button

src/components/NostrActivity.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
22
import { useNavigate } from "@solidjs/router";
3-
import { createEffect, createResource, For, Match, Switch } from "solid-js";
4-
3+
import { Search } from "lucide-solid";
4+
import {
5+
createEffect,
6+
createResource,
7+
For,
8+
Match,
9+
Show,
10+
Switch
11+
} from "solid-js";
12+
13+
import { ButtonCard, NiceP } from "~/components/layout";
514
import { useI18n } from "~/i18n/context";
615
import { useMegaStore } from "~/state/megaStore";
716
import { fetchZaps, getPrimalImageUrl } from "~/utils";
@@ -109,6 +118,14 @@ export function NostrActivity() {
109118

110119
return (
111120
<div class="flex w-full flex-col divide-y divide-m-grey-800 overflow-x-clip">
121+
<Show when={!data.latest || data.latest?.zaps.length === 0}>
122+
<ButtonCard onClick={() => navigate("/search")}>
123+
<div class="flex items-center gap-2">
124+
<Search class="inline-block text-m-red" />
125+
<NiceP>{i18n.t("home.find")}</NiceP>
126+
</div>
127+
</ButtonCard>
128+
</Show>
112129
<For each={data.latest?.zaps}>
113130
{(zap) => (
114131
<>

src/components/OnboardWarning.tsx

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/components/PendingNwc.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TagItem } from "@mutinywallet/mutiny-wasm";
2-
import { A } from "@solidjs/router";
3-
import { Check, X } from "lucide-solid";
2+
import { A, useNavigate } from "@solidjs/router";
3+
import { Check, PlugZap, X } from "lucide-solid";
44
import {
55
createEffect,
66
createResource,
@@ -11,7 +11,7 @@ import {
1111
Switch
1212
} from "solid-js";
1313

14-
import { Card, InfoBox, NiceP } from "~/components";
14+
import { ButtonCard, Card, InfoBox, NiceP } from "~/components";
1515
import { useI18n } from "~/i18n/context";
1616
import { useMegaStore } from "~/state/megaStore";
1717
import {
@@ -36,6 +36,8 @@ export function PendingNwc() {
3636

3737
const [error, setError] = createSignal<Error>();
3838

39+
const navigate = useNavigate();
40+
3941
async function fetchPendingRequests() {
4042
const profiles = await state.mutiny_wallet?.get_nwc_profiles();
4143
if (!profiles) return [];
@@ -209,12 +211,12 @@ export function PendingNwc() {
209211
</div>
210212
</Match>
211213
<Match when={true}>
212-
<Card>
213-
<NiceP>
214-
No pending requests. Maybe you want to add a{" "}
215-
<A href="/settings/connections">Wallet Connection</A>?
216-
</NiceP>
217-
</Card>
214+
<ButtonCard onClick={() => navigate("/settings/connections")}>
215+
<div class="flex items-center gap-2">
216+
<PlugZap class="inline-block text-m-red" />
217+
<NiceP>{i18n.t("home.connection")}</NiceP>
218+
</div>
219+
</ButtonCard>
218220
</Match>
219221
</Switch>
220222
);

src/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export * from "./Logo";
2727
export * from "./Logs";
2828
export * from "./MoreInfoModal";
2929
export * from "./NavBar";
30-
export * from "./OnboardWarning";
3130
export * from "./PendingNwc";
3231
export * from "./Reader";
3332
export * from "./Reload";

src/components/layout/Misc.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ export const Card: ParentComponent<{
4949
);
5050
};
5151

52+
export const ButtonCard: ParentComponent<{
53+
onClick: () => void;
54+
}> = (props) => {
55+
return (
56+
<button
57+
onClick={() => props.onClick()}
58+
// class="flex flex-none items-center justify-center overflow-clip rounded-full border-b border-t border-b-white/10 border-t-white/50 text-3xl uppercase"
59+
class="flex w-full flex-col gap-2 rounded-xl border-b border-t border-b-white/10 border-t-white/50 bg-neutral-900 p-4 active:-mb-[1px] active:mt-[1px]"
60+
>
61+
{props.children}
62+
</button>
63+
);
64+
};
65+
5266
export const InnerCard: ParentComponent<{ title?: string }> = (props) => {
5367
return (
5468
<div class="flex flex-col gap-2 rounded-xl border border-white/10 bg-[rgba(255,255,255,0.05)] p-4">

0 commit comments

Comments
 (0)