@indietabletop/appkit 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { Form, useStoreState } from "@ariakit/react";
2
2
  import { type Dispatch, type SetStateAction, useState } from "react";
3
- import { Link, useLocation } from "wouter";
3
+ import { Link } from "wouter";
4
4
  import { useAppConfig, useClient } from "../AppConfig/AppConfig.tsx";
5
5
  import { cx } from "../class-names.ts";
6
6
  import { interactiveText } from "../common.css.ts";
@@ -163,14 +163,7 @@ type SubmitCodeStepProps = {
163
163
 
164
164
  function SubmitCodeStep(props: SubmitCodeStepProps) {
165
165
  const { tokenId, email, setStep } = props;
166
- const [_, navigate] = useLocation();
167
166
  const client = useClient();
168
- const redirectPath = useRedirectPath();
169
-
170
- // Use redirect path if found in search params, otherwise go the success step.
171
- const onSuccess = redirectPath
172
- ? () => navigate(redirectPath)
173
- : () => setStep({ type: "SUCCESS" });
174
167
 
175
168
  const { form, submitName } = useForm({
176
169
  defaultValues: {
@@ -185,7 +178,9 @@ function SubmitCodeStep(props: SubmitCodeStepProps) {
185
178
  });
186
179
  });
187
180
  },
188
- onSuccess,
181
+ onSuccess() {
182
+ setStep({ type: "SUCCESS" });
183
+ },
189
184
  });
190
185
 
191
186
  return (
@@ -218,6 +213,8 @@ function SubmitCodeStep(props: SubmitCodeStepProps) {
218
213
 
219
214
  function SuccessStep() {
220
215
  const { hrefs } = useAppConfig();
216
+ const redirectPath = useRedirectPath();
217
+
221
218
  return (
222
219
  <Letterhead>
223
220
  <LetterheadHeader>
@@ -227,8 +224,8 @@ function SuccessStep() {
227
224
  </LetterheadParagraph>
228
225
  </LetterheadHeader>
229
226
 
230
- <Link href={hrefs.dashboard()} {...cx(button())}>
231
- Go to dashboard
227
+ <Link href={redirectPath ?? hrefs.dashboard()} {...cx(button())}>
228
+ {redirectPath ? "Continue" : "Go to dashboard"}
232
229
  </Link>
233
230
  </Letterhead>
234
231
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indietabletop/appkit",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "A collection of modules used in apps built by Indie Tabletop Club",
5
5
  "private": false,
6
6
  "type": "module",