Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Open same page when clicking on make changes on local machine
Merged did:key:z6MkkfM3...sVz5 opened 2 years ago
5 files changed +25 -21 a602f5d2 90de4d53
modified src/components/ConnectInstructions.svelte
@@ -1,8 +1,9 @@
<script>
-
  import { api, httpdStore } from "@app/lib/httpd";
  import Command from "./Command.svelte";
+
  import { api, httpdStore } from "@app/lib/httpd";
+
  import { routeToPath, activeUnloadedRouteStore } from "@app/lib/router";

-
  $: path = window.location.href.replace(window.location.origin, "");
+
  $: path = routeToPath($activeUnloadedRouteStore);
  $: pathParam = path === "/" ? "" : `--path "${path}"`;
</script>

modified src/lib/router.ts
@@ -16,10 +16,11 @@ import { nodePath } from "@app/views/nodes/router";

export { type Route };

+
const InitialStore = { resource: "booting" as const };
+

export const isLoading = writable<boolean>(true);
-
export const activeRouteStore = writable<LoadedRoute>({
-
  resource: "booting",
-
});
+
export const activeRouteStore = writable<LoadedRoute>(InitialStore);
+
export const activeUnloadedRouteStore = writable<Route>(InitialStore);

let currentUrl: URL | undefined;

@@ -112,6 +113,7 @@ async function navigate(

  setTitle(loadedRoute);
  activeRouteStore.set(loadedRoute);
+
  activeUnloadedRouteStore.set(newRoute);
  isLoading.set(false);
}

@@ -189,7 +191,7 @@ function extractBaseUrl(hostAndPort: string): BaseUrl {
  }
}

-
export function urlToRoute(url: URL): Route | null {
+
function urlToRoute(url: URL): Route | null {
  const segments = url.pathname.substring(1).split("/");

  const resource = segments.shift();
modified src/views/projects/Header/ShareButton.svelte
@@ -4,7 +4,7 @@
  import { queryProject } from "@app/lib/projects";
  import { config } from "@app/lib/config";
  import { formatPublicExplorer } from "@app/lib/utils";
-
  import { routeToPath, urlToRoute } from "@app/lib/router";
+
  import { activeUnloadedRouteStore, routeToPath } from "@app/lib/router";

  import Clipboard from "@app/components/Clipboard.svelte";
  import Command from "@app/components/Command.svelte";
@@ -17,7 +17,7 @@

  let usedFallbackSeed = false;

-
  const route = urlToRoute(new URL(window.location.href)) as ProjectRoute;
+
  const route = $activeUnloadedRouteStore as ProjectRoute;
  const seedRoutes = preferredSeeds.reduce<ProjectRoute[]>((acc, seed) => {
    const [, address] = seed.split("@");
    acc.push({
modified src/views/projects/Sidebar/ContextHelp.svelte
@@ -1,6 +1,8 @@
<script lang="ts">
  import type { BaseUrl } from "@httpd-client";
+
  import type { Route } from "@app/lib/router/definitions";

+
  import { activeUnloadedRouteStore } from "@app/lib/router";
  import { api, httpdStore } from "@app/lib/httpd";
  import { isLocal } from "@app/lib/utils";

@@ -16,6 +18,15 @@
  export let localProject: "notFound" | "found" | undefined;
  export let projectId: string;
  export let popover: boolean = false;
+

+
  let route: Route;
+

+
  $: {
+
    route = $activeUnloadedRouteStore;
+
    if ("node" in route) {
+
      route.node = api.baseUrl;
+
    }
+
  }
</script>

<style>
@@ -56,13 +67,7 @@

  {#if !hideLocalButton}
    <div style:padding-top="1rem">
-
      <Link
-
        disabled={disableLocalButton}
-
        route={{
-
          resource: "project.source",
-
          node: api.baseUrl,
-
          project: projectId,
-
        }}>
+
      <Link {route} disabled={disableLocalButton}>
        <Button size="large" styleWidth="100%" disabled={disableLocalButton}>
          <IconSmall name="device" />Make changes on your local node
        </Button>
modified src/views/session/Index.svelte
@@ -35,14 +35,10 @@
        },
      });
    }
-
    const route = router.urlToRoute(
+
    void router.navigateToUrl(
+
      "replace",
      new URL(activeRoute.params.path || "", window.location.origin),
    );
-
    if (route) {
-
      void router.push(route);
-
    } else {
-
      void router.push({ resource: "home" });
-
    }
  });
</script>