mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-30 12:24:20 +01:00
handle missing id on activity list items
This commit is contained in:
committed by
benthecarman
parent
6ad4184566
commit
db3f5c9d2f
@@ -51,10 +51,6 @@ function UnifiedActivityItem(props: {
|
||||
item: MutinyActivity;
|
||||
onClick: (id: string, kind: HackActivityType) => void;
|
||||
}) {
|
||||
onMount(() => {
|
||||
console.log(props.item);
|
||||
});
|
||||
|
||||
const click = () => {
|
||||
props.onClick(
|
||||
props.item.id,
|
||||
@@ -87,6 +83,12 @@ export function CombinedActivity(props: { limit?: number }) {
|
||||
function openDetailsModal(id: string, kind: HackActivityType) {
|
||||
console.log("Opening details modal: ", id, kind);
|
||||
|
||||
// Some old channels don't have a channel id in the activity list
|
||||
if (!id) {
|
||||
console.warn("No id provided to openDetailsModal");
|
||||
return;
|
||||
}
|
||||
|
||||
setDetailsId(id);
|
||||
setDetailsKind(kind);
|
||||
setDetailsOpen(true);
|
||||
|
||||
@@ -183,13 +183,13 @@ export function ActivityItem(props: {
|
||||
</Match>
|
||||
<Match when={props.positive}>
|
||||
<span class="text-base font-semibold text-neutral-500">
|
||||
Unknown sender
|
||||
Unknown
|
||||
</span>
|
||||
</Match>
|
||||
|
||||
<Match when={!props.positive}>
|
||||
<span class="text-base font-semibold text-neutral-500">
|
||||
Unknown receiver
|
||||
Unknown
|
||||
</span>
|
||||
</Match>
|
||||
</Switch>
|
||||
|
||||
@@ -235,7 +235,6 @@ function OnchainDetails(props: { info: OnChainTx; kind?: HackActivityType }) {
|
||||
const channel = channels.find((channel) =>
|
||||
channel.outpoint?.startsWith(props.info.txid)
|
||||
);
|
||||
console.log(channel);
|
||||
return channel;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -355,20 +354,20 @@ export function DetailsIdModal(props: {
|
||||
// TODO: is there a cleaner way to do refetch when id changes?
|
||||
const [data, { refetch }] = createResource(async () => {
|
||||
if (kind() === "Lightning") {
|
||||
console.log("reading invoice: ", id());
|
||||
console.debug("reading invoice: ", id());
|
||||
const invoice = await state.mutiny_wallet?.get_invoice_by_hash(
|
||||
id()
|
||||
);
|
||||
return invoice;
|
||||
} else if (kind() === "ChannelClose") {
|
||||
console.log("reading channel close: ", id());
|
||||
console.debug("reading channel close: ", id());
|
||||
const closeItem = await state.mutiny_wallet?.get_channel_closure(
|
||||
id()
|
||||
);
|
||||
|
||||
return closeItem;
|
||||
} else {
|
||||
console.log("reading tx: ", id());
|
||||
console.debug("reading tx: ", id());
|
||||
const tx = await state.mutiny_wallet?.get_transaction(id());
|
||||
|
||||
return tx;
|
||||
|
||||
@@ -27,7 +27,6 @@ function ContactRow() {
|
||||
const [state, _actions] = useMegaStore();
|
||||
const [contacts, { refetch }] = createResource(async () => {
|
||||
const contacts = state.mutiny_wallet?.get_contacts();
|
||||
console.log(contacts);
|
||||
|
||||
// FIXME: this is just types shenanigans I believe
|
||||
const c: Contact[] = [];
|
||||
|
||||
Reference in New Issue
Block a user