diff --git a/extension/package.json b/extension/package.json index 4be21fd..462e006 100644 --- a/extension/package.json +++ b/extension/package.json @@ -1,9 +1,8 @@ { - "name": "slash-extexnsion", + "name": "slash-extension", "displayName": "Slash", - "version": "0.1.1", + "version": "0.1.2", "description": "An open source, self-hosted bookmarks and link sharing platform. Save and share your links very easily.", - "author": "steven", "scripts": { "dev": "plasmo dev", "build": "plasmo build", diff --git a/extension/src/components/CreateShortcutsButton.tsx b/extension/src/components/CreateShortcutsButton.tsx index 76043b2..7768d56 100644 --- a/extension/src/components/CreateShortcutsButton.tsx +++ b/extension/src/components/CreateShortcutsButton.tsx @@ -1,10 +1,9 @@ -import { Button, Input, Modal, ModalDialog } from "@mui/joy"; +import { Button, IconButton, Input, Modal, ModalDialog } from "@mui/joy"; import { useStorage } from "@plasmohq/storage/hook"; import axios from "axios"; import { useState } from "react"; import { toast } from "react-hot-toast"; import { CreateShortcutResponse, OpenGraphMetadata, Visibility } from "@/types/proto/api/v2/shortcut_service_pb"; -import "../style.css"; import Icon from "./Icon"; const generateTempName = (length = 6) => { @@ -116,9 +115,9 @@ const CreateShortcutsButton = () => { return ( <> - + diff --git a/extension/src/components/Logo.tsx b/extension/src/components/Logo.tsx new file mode 100644 index 0000000..8ae5ebe --- /dev/null +++ b/extension/src/components/Logo.tsx @@ -0,0 +1,12 @@ +import classNames from "classnames"; +import LogoBase64 from "data-base64:../..//assets/icon.png"; + +interface Props { + className?: string; +} + +const Logo = ({ className }: Props) => { + return ; +}; + +export default Logo; diff --git a/extension/src/components/PullShortcutsButton.tsx b/extension/src/components/PullShortcutsButton.tsx index 07ffd02..064c4e3 100644 --- a/extension/src/components/PullShortcutsButton.tsx +++ b/extension/src/components/PullShortcutsButton.tsx @@ -1,17 +1,15 @@ -import { Button } from "@mui/joy"; +import { IconButton } from "@mui/joy"; import { useStorage } from "@plasmohq/storage/hook"; import axios from "axios"; -import { useEffect, useState } from "react"; +import { useEffect } from "react"; import { toast } from "react-hot-toast"; import { ListShortcutsResponse } from "@/types/proto/api/v2/shortcut_service_pb"; -import "../style.css"; import Icon from "./Icon"; const PullShortcutsButton = () => { const [domain] = useStorage("domain"); const [accessToken] = useStorage("access_token"); const [, setShortcuts] = useStorage("shortcuts"); - const [isPulling, setIsPulling] = useState(false); useEffect(() => { if (domain && accessToken) { @@ -21,7 +19,6 @@ const PullShortcutsButton = () => { const handlePullShortcuts = async (silence = false) => { try { - setIsPulling(true); const { data: { shortcuts }, } = await axios.get(`${domain}/api/v2/shortcuts`, { @@ -36,13 +33,12 @@ const PullShortcutsButton = () => { } catch (error) { toast.error("Failed to pull shortcuts, error: " + error.message); } - setIsPulling(false); }; return ( - + ); }; diff --git a/extension/src/options.tsx b/extension/src/options.tsx index aabae42..200ecd8 100644 --- a/extension/src/options.tsx +++ b/extension/src/options.tsx @@ -4,6 +4,7 @@ import { useStorage } from "@plasmohq/storage/hook"; import { useEffect, useState } from "react"; import { Toaster, toast } from "react-hot-toast"; import Icon from "./components/Icon"; +import Logo from "./components/Logo"; import PullShortcutsButton from "./components/PullShortcutsButton"; import ShortcutsContainer from "./components/ShortcutsContainer"; import "./style.css"; @@ -59,11 +60,11 @@ const IndexOptions = () => {
-

- - Slash +

+ + Slash / - Setting + Setting

@@ -114,7 +115,7 @@ const IndexOptions = () => { <> -

+

Shortcuts ({shortcuts.length}) diff --git a/extension/src/popup.tsx b/extension/src/popup.tsx index 559523f..7b9d3fc 100644 --- a/extension/src/popup.tsx +++ b/extension/src/popup.tsx @@ -1,11 +1,12 @@ -import { Button } from "@mui/joy"; +import { Button, Divider, IconButton } from "@mui/joy"; import { useStorage } from "@plasmohq/storage/hook"; import { Toaster } from "react-hot-toast"; +import CreateShortcutsButton from "@/components/CreateShortcutsButton"; +import Icon from "@/components/Icon"; +import Logo from "@/components/Logo"; +import PullShortcutsButton from "@/components/PullShortcutsButton"; +import ShortcutsContainer from "@/components/ShortcutsContainer"; import { Shortcut } from "@/types/proto/api/v2/shortcut_service_pb"; -import CreateShortcutsButton from "./components/CreateShortcutsButton"; -import Icon from "./components/Icon"; -import PullShortcutsButton from "./components/PullShortcutsButton"; -import ShortcutsContainer from "./components/ShortcutsContainer"; import "./style.css"; const IndexPopup = () => { @@ -20,6 +21,7 @@ const IndexPopup = () => { const handleRefreshButtonClick = () => { chrome.runtime.reload(); + chrome.browserAction.setPopup({ popup: "" }); }; return ( @@ -27,7 +29,7 @@ const IndexPopup = () => {
- + Slash {isInitialized && ( <> @@ -52,18 +54,15 @@ const IndexPopup = () => {
)} -
- - - - GitHub - + + + +
) : (