Switch to absolute imports
This commit is contained in:
+13
-13
@@ -1,19 +1,19 @@
|
||||
import { createEffect, Show } from "solid-js"
|
||||
import { Router, Route, useLocation, useNavigate } from "@solidjs/router"
|
||||
import type { Component } from "solid-js"
|
||||
import AppShell from "./components/AppShell"
|
||||
import Home from "./pages/Home"
|
||||
import RelayList from "./pages/relays/RelayList"
|
||||
import RelayNew from "./pages/relays/RelayNew"
|
||||
import RelayDetail from "./pages/relays/RelayDetail"
|
||||
import RelayEdit from "./pages/relays/RelayEdit"
|
||||
import Account from "./pages/Account"
|
||||
import AdminTenantList from "./pages/admin/AdminTenantList"
|
||||
import AdminTenantDetail from "./pages/admin/AdminTenantDetail"
|
||||
import AdminRelayList from "./pages/admin/AdminRelayList"
|
||||
import AdminRelayDetail from "./pages/admin/AdminRelayDetail"
|
||||
import AdminRelayEdit from "./pages/admin/AdminRelayEdit"
|
||||
import { identity } from "./lib/hooks"
|
||||
import AppShell from "@/components/AppShell"
|
||||
import Home from "@/pages/Home"
|
||||
import RelayList from "@/pages/relays/RelayList"
|
||||
import RelayNew from "@/pages/relays/RelayNew"
|
||||
import RelayDetail from "@/pages/relays/RelayDetail"
|
||||
import RelayEdit from "@/pages/relays/RelayEdit"
|
||||
import Account from "@/pages/Account"
|
||||
import AdminTenantList from "@/pages/admin/AdminTenantList"
|
||||
import AdminTenantDetail from "@/pages/admin/AdminTenantDetail"
|
||||
import AdminRelayList from "@/pages/admin/AdminRelayList"
|
||||
import AdminRelayDetail from "@/pages/admin/AdminRelayDetail"
|
||||
import AdminRelayEdit from "@/pages/admin/AdminRelayEdit"
|
||||
import { identity } from "@/lib/state"
|
||||
|
||||
function Layout(props: { children?: any }) {
|
||||
const location = useLocation()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { A, useLocation } from "@solidjs/router"
|
||||
import { createEffect, createMemo, createSignal, For, onCleanup, Show } from "solid-js"
|
||||
import Fuse from "fuse.js"
|
||||
import { account, eventStore, identity, primeProfiles, useProfilePicture, useTenantRelays, type Relay } from "../lib/hooks"
|
||||
import serverIcon from "../assets/server.svg"
|
||||
import Modal from "./Modal"
|
||||
import { primeProfiles, useProfilePicture, useTenantRelays, type Relay } from "@/lib/hooks"
|
||||
import { account, eventStore, identity } from "@/lib/state"
|
||||
import serverIcon from "@/assets/server.svg"
|
||||
import Modal from "@/components/Modal"
|
||||
|
||||
type Profile = {
|
||||
name?: string
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Show } from "solid-js"
|
||||
import { A } from "@solidjs/router"
|
||||
import { PLATFORM_NAME, useProfilePicture, account } from "../lib/hooks"
|
||||
import { useProfilePicture } from "@/lib/hooks"
|
||||
import { PLATFORM_NAME, account } from "@/lib/state"
|
||||
|
||||
export default function Navbar() {
|
||||
const picture = useProfilePicture(() => account()?.pubkey)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { A } from "@solidjs/router"
|
||||
import { For } from "solid-js"
|
||||
import { RELAY_PLANS, type RelayPlanId } from "../lib/relayPlans"
|
||||
import { RELAY_PLANS, type RelayPlanId } from "@/lib/relayPlans"
|
||||
|
||||
function CheckIcon() {
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { A } from "@solidjs/router"
|
||||
import { Show, createEffect, createSignal, onCleanup } from "solid-js"
|
||||
import type { Relay } from "../lib/api"
|
||||
import menuDotsIcon from "../assets/menu-dots-2.svg"
|
||||
import Modal from "./Modal"
|
||||
import PricingTable from "./PricingTable"
|
||||
import { RELAY_PLAN_IDS, type RelayPlanId } from "../lib/relayPlans"
|
||||
import type { Relay } from "@/lib/api"
|
||||
import menuDotsIcon from "@/assets/menu-dots-2.svg"
|
||||
import Modal from "@/components/Modal"
|
||||
import PricingTable from "@/components/PricingTable"
|
||||
import { RELAY_PLAN_IDS, type RelayPlanId } from "@/lib/relayPlans"
|
||||
|
||||
function Field(props: { label: string; children: any }) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createEffect, createSignal } from "solid-js"
|
||||
import type { Relay } from "../lib/hooks"
|
||||
import { slugify } from "../lib/slugify"
|
||||
import type { Relay } from "@/lib/hooks"
|
||||
import { slugify } from "@/lib/slugify"
|
||||
|
||||
export type RelayFormValues = {
|
||||
info_name: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Show } from "solid-js"
|
||||
import LoadingState from "./LoadingState"
|
||||
import LoadingState from "@/components/LoadingState"
|
||||
|
||||
type ResourceStateProps = {
|
||||
loading: boolean
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* @refresh reload */
|
||||
import { render } from "solid-js/web"
|
||||
import "./index.css"
|
||||
import App from "./App"
|
||||
import { PLATFORM_NAME } from "./lib/hooks"
|
||||
import App from "@/App"
|
||||
import { PLATFORM_NAME } from "@/lib/state"
|
||||
|
||||
const root = document.getElementById("root")!
|
||||
|
||||
|
||||
+28
-28
@@ -1,4 +1,4 @@
|
||||
import { account } from "./hooks"
|
||||
import { account } from "@/lib/state"
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL
|
||||
|
||||
@@ -51,33 +51,6 @@ export type Relay = {
|
||||
push_enabled: number
|
||||
}
|
||||
|
||||
export type Tenant = {
|
||||
pubkey: string
|
||||
nwc_url: string
|
||||
created_at: number
|
||||
billing_anchor: number
|
||||
}
|
||||
|
||||
export type Invoice = {
|
||||
id: string
|
||||
tenant: string
|
||||
status: string
|
||||
created_at: number
|
||||
attempted_at: number
|
||||
error: string
|
||||
closed_at: number
|
||||
sent_at: number
|
||||
paid_at: number
|
||||
bolt11: string
|
||||
period_start: number
|
||||
period_end: number
|
||||
}
|
||||
|
||||
export type Identity = {
|
||||
pubkey: string
|
||||
is_admin: boolean
|
||||
}
|
||||
|
||||
export type CreateRelayInput = {
|
||||
tenant?: string
|
||||
subdomain: string
|
||||
@@ -109,6 +82,33 @@ export type UpdateRelayInput = {
|
||||
push_enabled?: number
|
||||
}
|
||||
|
||||
export type Tenant = {
|
||||
pubkey: string
|
||||
nwc_url: string
|
||||
created_at: number
|
||||
billing_anchor: number
|
||||
}
|
||||
|
||||
export type Invoice = {
|
||||
id: string
|
||||
tenant: string
|
||||
status: string
|
||||
created_at: number
|
||||
attempted_at: number
|
||||
error: string
|
||||
closed_at: number
|
||||
sent_at: number
|
||||
paid_at: number
|
||||
bolt11: string
|
||||
period_start: number
|
||||
period_end: number
|
||||
}
|
||||
|
||||
export type Identity = {
|
||||
pubkey: string
|
||||
is_admin: boolean
|
||||
}
|
||||
|
||||
export async function makeAuth(): Promise<string | undefined> {
|
||||
const current = account()
|
||||
if (!current) return undefined
|
||||
|
||||
@@ -19,23 +19,8 @@ import {
|
||||
type Relay,
|
||||
type Tenant,
|
||||
type UpdateRelayInput,
|
||||
} from "./api"
|
||||
import { account, eventStore, pool } from "./state"
|
||||
|
||||
export {
|
||||
PLATFORM_NAME,
|
||||
accountManager,
|
||||
account,
|
||||
setAccount,
|
||||
identity,
|
||||
refetchIdentity,
|
||||
setIdentity,
|
||||
eventStore,
|
||||
pool,
|
||||
type EventSigner,
|
||||
type SignedEvent,
|
||||
type UnsignedEvent,
|
||||
} from "./state"
|
||||
} from "@/lib/api"
|
||||
import { account, eventStore, pool } from "@/lib/state"
|
||||
|
||||
export function useProfilePicture(pubkey: () => string | undefined) {
|
||||
const [picture, setPicture] = createSignal<string | undefined>()
|
||||
|
||||
@@ -6,7 +6,7 @@ import { EventStore } from "applesauce-core"
|
||||
import { createEventLoaderForStore } from "applesauce-loaders/loaders"
|
||||
import { RelayPool } from "applesauce-relay"
|
||||
import { NostrConnectSigner } from "applesauce-signers"
|
||||
import { getIdentity } from "./api"
|
||||
import { getIdentity } from "@/lib/api"
|
||||
|
||||
export type UnsignedEvent = {
|
||||
kind: number
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createEffect, createMemo, createSignal, For, Show } from "solid-js"
|
||||
import PageContainer from "../components/PageContainer"
|
||||
import LoadingState from "../components/LoadingState"
|
||||
import useMinLoading from "../components/useMinLoading"
|
||||
import { updateActiveTenantBilling, useTenant, useTenantInvoices } from "../lib/hooks"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import LoadingState from "@/components/LoadingState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { updateActiveTenantBilling, useTenant, useTenantInvoices } from "@/lib/hooks"
|
||||
|
||||
export default function Account() {
|
||||
const [tenant, { refetch: refetchTenant }] = useTenant()
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { A, useNavigate } from "@solidjs/router"
|
||||
import { createSignal } from "solid-js"
|
||||
import CheckIcon from "../components/CheckIcon"
|
||||
import ExternalLinkIcon from "../components/ExternalLinkIcon"
|
||||
import PricingTable from "../components/PricingTable"
|
||||
import RelayForm, { type RelayFormValues } from "../components/RelayForm"
|
||||
import Modal from "../components/Modal"
|
||||
import Login from "../views/Login"
|
||||
import { account, createRelayForActiveTenant } from "../lib/hooks"
|
||||
import { slugify } from "../lib/slugify"
|
||||
import CheckIcon from "@/components/CheckIcon"
|
||||
import ExternalLinkIcon from "@/components/ExternalLinkIcon"
|
||||
import PricingTable from "@/components/PricingTable"
|
||||
import RelayForm, { type RelayFormValues } from "@/components/RelayForm"
|
||||
import Modal from "@/components/Modal"
|
||||
import Login from "@/views/Login"
|
||||
import { createRelayForActiveTenant } from "@/lib/hooks"
|
||||
import { account } from "@/lib/state"
|
||||
import { slugify } from "@/lib/slugify"
|
||||
|
||||
export default function Home() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useParams } from "@solidjs/router"
|
||||
import { createSignal, Show } from "solid-js"
|
||||
import BackLink from "../../components/BackLink"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import RelayDetailCard from "../../components/RelayDetailCard"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { deactivateRelayById, updateRelayById, useRelay, type Relay } from "../../lib/hooks"
|
||||
import BackLink from "@/components/BackLink"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import RelayDetailCard from "@/components/RelayDetailCard"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { deactivateRelayById, updateRelayById, useRelay, type Relay } from "@/lib/hooks"
|
||||
|
||||
export default function AdminRelayDetail() {
|
||||
const params = useParams()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useNavigate, useParams } from "@solidjs/router"
|
||||
import { Show, createSignal } from "solid-js"
|
||||
import RelayForm, { type RelayFormValues } from "../../components/RelayForm"
|
||||
import { slugify } from "../../lib/slugify"
|
||||
import BackLink from "../../components/BackLink"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { updateRelayById, useRelay } from "../../lib/hooks"
|
||||
import RelayForm, { type RelayFormValues } from "@/components/RelayForm"
|
||||
import { slugify } from "@/lib/slugify"
|
||||
import BackLink from "@/components/BackLink"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { updateRelayById, useRelay } from "@/lib/hooks"
|
||||
|
||||
export default function AdminRelayEdit() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { A } from "@solidjs/router"
|
||||
import Fuse from "fuse.js"
|
||||
import { createMemo, createSignal, For, Show } from "solid-js"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { useAdminRelays } from "../../lib/hooks"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { useAdminRelays } from "@/lib/hooks"
|
||||
|
||||
export default function AdminRelayList() {
|
||||
const [query, setQuery] = createSignal("")
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useParams, A } from "@solidjs/router"
|
||||
import { For, Show } from "solid-js"
|
||||
import BackLink from "../../components/BackLink"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { useAdminTenant, useAdminTenantRelays } from "../../lib/hooks"
|
||||
import BackLink from "@/components/BackLink"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { useAdminTenant, useAdminTenantRelays } from "@/lib/hooks"
|
||||
|
||||
export default function AdminTenantDetail() {
|
||||
const params = useParams()
|
||||
|
||||
@@ -2,10 +2,11 @@ import { A } from "@solidjs/router"
|
||||
import Fuse from "fuse.js"
|
||||
import { createEffect, createMemo, createSignal, For, onCleanup, Show } from "solid-js"
|
||||
import { getProfilePicture } from "applesauce-core/helpers/profile"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { eventStore, primeProfiles, useAdminTenants } from "../../lib/hooks"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { primeProfiles, useAdminTenants } from "@/lib/hooks"
|
||||
import { eventStore } from "@/lib/state"
|
||||
|
||||
function shortenPubkey(pubkey: string) {
|
||||
if (pubkey.length <= 16) return pubkey
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useParams } from "@solidjs/router"
|
||||
import { createMemo, createResource, createSignal, Show } from "solid-js"
|
||||
import type { RelayPlanId } from "../../lib/relayPlans"
|
||||
import BackLink from "../../components/BackLink"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import RelayDetailCard from "../../components/RelayDetailCard"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { deactivateRelayById, getRelayMembers, updateRelayById, updateRelayPlanById, useRelay, type Relay } from "../../lib/hooks"
|
||||
import type { RelayPlanId } from "@/lib/relayPlans"
|
||||
import BackLink from "@/components/BackLink"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import RelayDetailCard from "@/components/RelayDetailCard"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { deactivateRelayById, getRelayMembers, updateRelayById, updateRelayPlanById, useRelay, type Relay } from "@/lib/hooks"
|
||||
|
||||
export default function RelayDetail() {
|
||||
const params = useParams()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useNavigate, useParams } from "@solidjs/router"
|
||||
import { Show, createSignal } from "solid-js"
|
||||
import RelayForm, { type RelayFormValues } from "../../components/RelayForm"
|
||||
import { slugify } from "../../lib/slugify"
|
||||
import BackLink from "../../components/BackLink"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { updateRelayById, useRelay } from "../../lib/hooks"
|
||||
import RelayForm, { type RelayFormValues } from "@/components/RelayForm"
|
||||
import { slugify } from "@/lib/slugify"
|
||||
import BackLink from "@/components/BackLink"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { updateRelayById, useRelay } from "@/lib/hooks"
|
||||
|
||||
export default function RelayEdit() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { A } from "@solidjs/router"
|
||||
import Fuse from "fuse.js"
|
||||
import { createMemo, createSignal, For, Show } from "solid-js"
|
||||
import PageContainer from "../../components/PageContainer"
|
||||
import ResourceState from "../../components/ResourceState"
|
||||
import useMinLoading from "../../components/useMinLoading"
|
||||
import { useTenantRelays } from "../../lib/hooks"
|
||||
import PageContainer from "@/components/PageContainer"
|
||||
import ResourceState from "@/components/ResourceState"
|
||||
import useMinLoading from "@/components/useMinLoading"
|
||||
import { useTenantRelays } from "@/lib/hooks"
|
||||
|
||||
export default function RelayList() {
|
||||
const [relays] = useTenantRelays()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Show, createSignal } from "solid-js"
|
||||
import { useNavigate } from "@solidjs/router"
|
||||
import { slugify } from "../../lib/slugify"
|
||||
import { createRelayForActiveTenant } from "../../lib/hooks"
|
||||
import { slugify } from "@/lib/slugify"
|
||||
import { createRelayForActiveTenant } from "@/lib/hooks"
|
||||
|
||||
const PLANS = [
|
||||
{ id: "free", label: "Free", price: 0, members: "Up to 10", blossom: false, livekit: false },
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ExtensionAccount, NostrConnectAccount, PasswordAccount, PrivateKeyAccou
|
||||
import { PasswordSigner } from "applesauce-signers"
|
||||
import QrScanner from "qr-scanner"
|
||||
import QRCode from "qrcode"
|
||||
import { accountManager, identity, PLATFORM_NAME } from "../lib/hooks"
|
||||
import { accountManager, identity, PLATFORM_NAME } from "@/lib/state"
|
||||
|
||||
const NIP46_RELAYS = ['wss://bucket.coracle.social', 'wss://ephemeral.snowflare.cc']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user