Skip to content

Commit

Permalink
fix most of tony's problems
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Feb 19, 2024
1 parent a9a7346 commit 34f55b0
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 135 deletions.
69 changes: 38 additions & 31 deletions src/components/Activity.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { TagItem } from "@mutinywallet/mutiny-wasm";
import { cache, createAsync, revalidate } from "@solidjs/router";
import { Plus, Search, Shuffle } from "lucide-solid";
import { cache, createAsync, revalidate, useNavigate } from "@solidjs/router";
import { Plus, Save, Search, Shuffle } from "lucide-solid";
import { createEffect, createSignal, For, Match, Show, Switch } from "solid-js";

import {
ActivityDetailsModal,
Card,
ButtonCard,
HackActivityType,
NiceP
} from "~/components";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import { timeAgo } from "~/utils";

Expand Down Expand Up @@ -145,10 +146,12 @@ export function UnifiedActivityItem(props: {

export function CombinedActivity() {
const [state, _actions] = useMegaStore();
const i18n = useI18n();

const [detailsOpen, setDetailsOpen] = createSignal(false);
const [detailsKind, setDetailsKind] = createSignal<HackActivityType>();
const [detailsId, setDetailsId] = createSignal("");
const navigate = useNavigate();

function openDetailsModal(id: string, kind: HackActivityType) {
console.log("Opening details modal: ", id, kind);
Expand Down Expand Up @@ -195,36 +198,40 @@ export function CombinedActivity() {
</Show>
<Switch>
<Match when={activity().length === 0}>
<Card>
<NiceP>Welcome to the Mutiny.</NiceP>
</Card>
<Card>
{/* <NiceP>TODO: copywriting lol</NiceP> */}
<NiceP>
<span>
<Plus class="inline-block text-m-red" />
</span>{" "}
to receive your first sats.
</NiceP>
{/* <NiceP>
{i18n.t(
"activity.receive_some_sats_to_get_started"
)}
</NiceP> */}
</Card>
<Card>
<NiceP>
<span>
<Search class="inline-block text-m-red" />
</span>{" "}
to find your friends on nostr.
</NiceP>
</Card>
<Card>
<NiceP>Don't forget to back up your seed words!</NiceP>
</Card>
<ButtonCard onClick={() => navigate("/receive")}>
<div class="flex items-center gap-2">
<Plus class="inline-block text-m-red" />
<NiceP>{i18n.t("home.receive")}</NiceP>
</div>
</ButtonCard>
<ButtonCard onClick={() => navigate("/search")}>
<div class="flex items-center gap-2">
<Search class="inline-block text-m-red" />
<NiceP>{i18n.t("home.find")}</NiceP>
</div>
</ButtonCard>
<Show when={!state.has_backed_up}>
<ButtonCard
onClick={() => navigate("/settings/backup")}
>
<div class="flex items-center gap-2">
<Save class="inline-block text-m-red" />
<NiceP>{i18n.t("home.backup")}</NiceP>
</div>
</ButtonCard>
</Show>
</Match>
<Match when={activity().length >= 0}>
<Show when={!state.has_backed_up}>
<ButtonCard
onClick={() => navigate("/settings/backup")}
>
<div class="flex items-center gap-2">
<Save class="inline-block text-m-red" />
<NiceP>{i18n.t("home.backup")}</NiceP>
</div>
</ButtonCard>
</Show>
<div class="flex w-full flex-col divide-y divide-m-grey-800 overflow-x-clip">
<For each={activity()}>
{(activityItem) => (
Expand Down
5 changes: 0 additions & 5 deletions src/components/ActualSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,6 @@ export function ActualSearch(props: { initialValue?: string }) {
</button>
</Show>
</div>
{/* <Show when={!searchValue()}>
<Suspense fallback={<LoadingShimmer />}>
<MeOrEverybody />
</Suspense>
</Show> */}
<Show when={searchState() !== "notsendable"}>
<Button intent="green" onClick={handleContinue}>
Continue
Expand Down
22 changes: 16 additions & 6 deletions src/components/Fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ import { createSignal, JSX, onCleanup, onMount, Show } from "solid-js";

import { Circle } from "~/components";

function FabMenuItem(props: { onClick: () => void; children: JSX.Element }) {
function FabMenuItem(props: {
onClick: () => void;
disabled: boolean;
children: JSX.Element;
}) {
return (
<button class="flex gap-2 px-2 py-4" onClick={() => props.onClick}>
<button
class="flex gap-2 px-2 py-4 disabled:opacity-50"
disabled={props.disabled}
onClick={() => props.onClick()}
>
{props.children}
</button>
);
Expand Down Expand Up @@ -61,8 +69,8 @@ export function Fab(props: { onSearch: () => void; onScan: () => void }) {
<li>
<FabMenuItem

Check failure on line 70 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / Build APK

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.

Check failure on line 70 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / code_quality

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.
onClick={() => {
setOpen(false);
props.onSearch();
setOpen(false);
}}
>
<ArrowUpRight />
Expand Down Expand Up @@ -105,6 +113,7 @@ export function MiniFab(props: {
onSend: () => void;
onRequest: () => void;
onScan: () => void;
sendDisabled?: boolean | undefined;
}) {
const [open, setOpen] = createSignal(false);
return (
Expand All @@ -114,9 +123,10 @@ export function MiniFab(props: {
<ul class="flex flex-col divide-y divide-m-grey-400/25">
<li>
<FabMenuItem
disabled={props.sendDisabled || false}
onClick={() => {
setOpen(false);
props.onSend();
setOpen(false);
}}
>
<ArrowUpRight />
Expand All @@ -126,8 +136,8 @@ export function MiniFab(props: {
<li>
<FabMenuItem

Check failure on line 137 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / Build APK

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.

Check failure on line 137 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / code_quality

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.
onClick={() => {
setOpen(false);
props.onRequest();
setOpen(false);
}}
>
<ArrowDownLeft />
Expand All @@ -138,8 +148,8 @@ export function MiniFab(props: {
<li>
<FabMenuItem

Check failure on line 149 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / Build APK

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.

Check failure on line 149 in src/components/Fab.tsx

View workflow job for this annotation

GitHub Actions / code_quality

Type '{ children: (string | Element)[]; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { onClick: () => void; disabled: boolean; children: Element; }'.
onClick={() => {
setOpen(false);
props.onScan();
setOpen(false);
}}
>
<Scan />
Expand Down
2 changes: 1 addition & 1 deletion src/components/GenericItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function GenericItem(props: {
</Show>
{/* OPTIONAL MESSAGE */}
<Show when={props.message}>
<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">
<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">
{props.message}
</div>
</Show>
Expand Down
2 changes: 1 addition & 1 deletion src/components/HomeSubnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function HomeSubnav() {
}}
onClick={() => setActiveView("everybody")}
>
Everybody
Friends
</button>

<button
Expand Down
21 changes: 19 additions & 2 deletions src/components/NostrActivity.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
import { useNavigate } from "@solidjs/router";
import { createEffect, createResource, For, Match, Switch } from "solid-js";

import { Search } from "lucide-solid";
import {
createEffect,
createResource,
For,
Match,
Show,
Switch
} from "solid-js";

import { ButtonCard, NiceP } from "~/components/layout";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import { fetchZaps, getPrimalImageUrl } from "~/utils";
Expand Down Expand Up @@ -109,6 +118,14 @@ export function NostrActivity() {

return (
<div class="flex w-full flex-col divide-y divide-m-grey-800 overflow-x-clip">
<Show when={!data.latest || data.latest?.zaps.length === 0}>
<ButtonCard onClick={() => navigate("/search")}>
<div class="flex items-center gap-2">
<Search class="inline-block text-m-red" />
<NiceP>{i18n.t("home.find")}</NiceP>
</div>
</ButtonCard>
</Show>
<For each={data.latest?.zaps}>
{(zap) => (
<>
Expand Down
37 changes: 0 additions & 37 deletions src/components/OnboardWarning.tsx

This file was deleted.

20 changes: 11 additions & 9 deletions src/components/PendingNwc.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TagItem } from "@mutinywallet/mutiny-wasm";
import { A } from "@solidjs/router";
import { Check, X } from "lucide-solid";
import { A, useNavigate } from "@solidjs/router";

Check warning on line 2 in src/components/PendingNwc.tsx

View workflow job for this annotation

GitHub Actions / code_quality

'A' is defined but never used. Allowed unused vars must match /^_/u
import { Check, PlugZap, X } from "lucide-solid";
import {
createEffect,
createResource,
Expand All @@ -11,7 +11,7 @@ import {
Switch
} from "solid-js";

import { Card, InfoBox, NiceP } from "~/components";
import { ButtonCard, Card, InfoBox, NiceP } from "~/components";

Check warning on line 14 in src/components/PendingNwc.tsx

View workflow job for this annotation

GitHub Actions / code_quality

'Card' is defined but never used. Allowed unused vars must match /^_/u
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import {
Expand All @@ -36,6 +36,8 @@ export function PendingNwc() {

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

const navigate = useNavigate();

async function fetchPendingRequests() {
const profiles = await state.mutiny_wallet?.get_nwc_profiles();
if (!profiles) return [];
Expand Down Expand Up @@ -209,12 +211,12 @@ export function PendingNwc() {
</div>
</Match>
<Match when={true}>
<Card>
<NiceP>
No pending requests. Maybe you want to add a{" "}
<A href="/settings/connections">Wallet Connection</A>?
</NiceP>
</Card>
<ButtonCard onClick={() => navigate("/settings/connections")}>
<div class="flex items-center gap-2">
<PlugZap class="inline-block text-m-red" />
<NiceP>{i18n.t("home.connection")}</NiceP>
</div>
</ButtonCard>
</Match>
</Switch>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export * from "./Logo";
export * from "./Logs";
export * from "./MoreInfoModal";
export * from "./NavBar";
export * from "./OnboardWarning";
export * from "./PendingNwc";
export * from "./Reader";
export * from "./Reload";
Expand Down
14 changes: 14 additions & 0 deletions src/components/layout/Misc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ export const Card: ParentComponent<{
);
};

export const ButtonCard: ParentComponent<{
onClick: () => void;
}> = (props) => {
return (
<button
onClick={() => props.onClick()}
// 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"
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]"
>
{props.children}
</button>
);
};

export const InnerCard: ParentComponent<{ title?: string }> = (props) => {
return (
<div class="flex flex-col gap-2 rounded-xl border border-white/10 bg-[rgba(255,255,255,0.05)] p-4">
Expand Down
11 changes: 11 additions & 0 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ export default {
"Mutiny is running in safe mode. Lightning is disabled.",
self_hosted: "Self-hosted"
},
home: {
receive: "Receive your first sats",
find: "Find your friends on nostr",
backup: "Secure your funds!",
connection: "Create a wallet connection"
},
profile: {
nostr_identity: "Nostr Identity",
add_lightning_address: "Add Lightning Address",
edit_profile: "Edit Profile"
},
contacts: {
new: "new",
add_contact: "Add Contact",
Expand Down
Loading

0 comments on commit 34f55b0

Please sign in to comment.