Skip to content

Commit

Permalink
wire up invite scanning to autofill
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul authored and TonyGiorgio committed Dec 21, 2023
1 parent 3bd1d03 commit cb09dd7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
18 changes: 0 additions & 18 deletions src/components/HomePrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,8 @@ export function HomePrompt() {
}
return;
}

if (params.fedimint_invite) {
const fedimint_invite = params.fedimint_invite;
setParams({ fedimint_invite: undefined });
setFedi(fedimint_invite);
return;
}
});

// Fedi stuff
// fed11qgqzc2nhwden5te0vejkg6tdd9h8gepwvejkg6tdd9h8garhduhx6at5d9h8jmn9wshxxmmd9uqqzgxg6s3evnr6m9zdxr6hxkdkukexpcs3mn7mj3g5pc5dfh63l4tj6g9zk4er
const [fedi, setFedi] = createSignal<string>();

// Lnurl Auth stuff
const [lnurlauthResult, setLnurlauthResult] = createSignal<string>();
const [authLoading, setAuthLoading] = createSignal<boolean>(false);
Expand All @@ -87,13 +76,6 @@ export function HomePrompt() {

return (
<>
<SimpleDialog
title={i18n.t("modals.fedi_invite.title")}
open={!!fedi()}
setOpen={() => setFedi(undefined)}
>
<NiceP>{i18n.t("modals.fedi_invite.description")}</NiceP>
</SimpleDialog>
<SimpleDialog
title={i18n.t("modals.lnurl_auth.auth_request")}
open={!!lnurlauthResult()}
Expand Down
4 changes: 0 additions & 4 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,6 @@ export default {
decline: "Decline",
error: "That didn't work for some reason.",
authenticated: "Authenticated!"
},
fedi_invite: {
title: "Fedimint Invite",
description: "Fedimint support coming soon!"
}
}
};
19 changes: 16 additions & 3 deletions src/routes/settings/ManageFederations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import {
createForm,
required,
reset,
setValue,
SubmitHandler
} from "@modular-forms/solid";
import { createSignal, For, Show } from "solid-js";
import { useSearchParams } from "@solidjs/router";
import { createSignal, For, onMount, Show } from "solid-js";

import {
BackLink,
Expand Down Expand Up @@ -45,6 +47,17 @@ function AddFederationForm() {
const [error, setError] = createSignal<Error>();
const [success, setSuccess] = createSignal("");

const [params, setParams] = useSearchParams();

onMount(() => {
if (params.fedimint_invite) {
setValue(feedbackForm, "federation_code", params.fedimint_invite);

// Clear the search params
setParams({ fedimint_invite: undefined });
}
});

const [feedbackForm, { Form, Field }] = createForm<FederationForm>({
initialValues: {
federation_code: ""
Expand Down Expand Up @@ -93,14 +106,14 @@ function AddFederationForm() {
label={i18n.t(
"settings.manage_federations.federation_code_label"
)}
placeholder="fedi1..."
placeholder="fed11..."
required
/>
)}
</Field>
<Button
loading={feedbackForm.submitting}
disabled={!feedbackForm.touched || feedbackForm.invalid}
disabled={feedbackForm.invalid}
intent="blue"
type="submit"
>
Expand Down
2 changes: 1 addition & 1 deletion src/state/megaStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export const Provider: ParentComponent = (props) => {
}
if (result.value?.fedimint_invite) {
navigate(
"/?fedimint_invite=" +
"/settings/federations?fedimint_invite=" +
encodeURIComponent(result.value?.fedimint_invite)
);
actions.setScanResult(undefined);
Expand Down

0 comments on commit cb09dd7

Please sign in to comment.