mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-01-16 04:34:28 +01:00
wire up invite scanning to autofill
This commit is contained in:
committed by
Tony Giorgio
parent
3bd1d03377
commit
cb09dd7951
@@ -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);
|
||||
@@ -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()}
|
||||
|
||||
@@ -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!"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
@@ -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: ""
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user