Skip to content

Commit

Permalink
remove nrelay add local time
Browse files Browse the repository at this point in the history
  • Loading branch information
TsukemonoGit committed Oct 15, 2024
1 parent a8a5f14 commit c0d11d2
Show file tree
Hide file tree
Showing 8 changed files with 663 additions and 320 deletions.
4 changes: 2 additions & 2 deletions entrypoints/components/DecodableContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export default function DecodableContent({ content }: { content: string }) {
<Content content={nprofile} title={"nprofile"} />
</>
</Match>
<Match when={decoded()?.type === "nrelay"}>
{/* <Match when={decoded()?.type === "nrelay"}>
<>
<CopyButton text={decoded()?.data as string} />
</>
</Match>
</Match> */}
<Match when={decoded()?.type === "nevent"}>
<>
<Content
Expand Down
18 changes: 0 additions & 18 deletions entrypoints/components/RelayContent.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions entrypoints/components/UnixTime.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createMemo } from "solid-js";
import { className } from "../../util";

import CopyButton from "./CopyButton";
export default function UnixTime({ content }: { content: string }) {
const localTime = new Date(Number(content) * 1000).toLocaleString();
return (
<div class={className} style={{ "margin-top": "0.5em" }}>
<span class={className} style={{ color: "gray", "font-size": "small" }}>
local time
</span>
<CopyButton text={localTime} style={{ margin: "0.5em 0" }} />
</div>
);
}
6 changes: 3 additions & 3 deletions entrypoints/content/MenuComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import DecodableContent from "../components/DecodableContent";
import HexContent from "../components/HexContent";
import { hexRegex, encodableRegex } from "@/util";
import Nip33AtagContent from "../components/Nip33AtagContent";
import RelayContent from "../components/RelayContent";

export default function MenuComponent(props: {
position: { top: number; left: number };
Expand Down Expand Up @@ -74,8 +73,9 @@ export default function MenuComponent(props: {
return <DecodableContent content={props.content} />;
} else if (nip33Regex.test(props.content)) {
return <Nip33AtagContent content={props.content} />;
} else if (relayRegex.test(props.content)) {
return <RelayContent content={props.content} />;
//}
//else if (relayRegex.test(props.content)) {
// return <RelayContent content={props.content} />;
} else {
return <div>Invalid content</div>;
}
Expand Down
12 changes: 8 additions & 4 deletions entrypoints/popup/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ import { encodableRegex, hexRegex, nip33Regex, relayRegex } from "@/util";
import HexContent from "../components/HexContent";
import DecodableContent from "../components/DecodableContent";
import Nip33AtagContent from "../components/Nip33AtagContent";
import RelayContent from "../components/RelayContent";
import UnixTime from "../components/UnixTime";

function App() {
const [selectedText, setSelectedText] = createSignal("");

const nakeContent = createMemo(() => {
if (selectedText()) {
if (hexRegex.test(selectedText())) {
if (/^\d+$/.test(selectedText())) {
return <UnixTime content={selectedText()} />;
} else if (hexRegex.test(selectedText())) {
return <HexContent content={selectedText()} />;
} else if (encodableRegex.test(selectedText())) {
return <DecodableContent content={selectedText()} />;
} else if (nip33Regex.test(selectedText())) {
return <Nip33AtagContent content={selectedText()} />;
} else if (relayRegex.test(selectedText())) {
return <RelayContent content={selectedText()} />;
}
//else if (relayRegex.test(selectedText())) {
// return <RelayContent content={selectedText()} />;
// }
} else {
return <div>Invalid content</div>;
}
Expand Down
Loading

0 comments on commit c0d11d2

Please sign in to comment.