MCPcopy Create free account
hub / github.com/027xiguapi/code-box / IndexSidePanel

Function IndexSidePanel

sidepanel/index.tsx:14–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12import styles from "./index.module.scss"
13
14function IndexSidePanel() {
15 const [codes] = useStorage("app-codes", [])
16 const [summary, setSummary] = useStorage("app-summary", {
17 title: "",
18 score: "",
19 content: ""
20 })
21
22 useMessage((req: any, res: any) => {
23 if (req.name === "isSidePanelOpen") {
24 return true
25 }
26 if (req.name == "sidepanel") {
27 req.body.active || window.close()
28 }
29 })
30
31 function pinCode(index) {
32 sendToContentScript({ name: `custom-scrollIntoViewCode`, body: { index } })
33 }
34
35 function downloadCode(index) {
36 sendToContentScript({ name: `custom-downloadCode`, body: { index } })
37 }
38
39 return (
40 <ThemeProvider>
41 <div className={`${styles.sidepanel}`}>
42 <div className="wechat">
43 <h1>微信公众号</h1>
44 <img style={{ margin: "auto" }} src={qrcodeUrl} alt="微信公众号" />
45 </div>
46 <div className="content">
47 {summary.content ? (
48 <div className="summary">
49 <div className="title">
50 {summary.title}(评分:{summary.score})
51 </div>
52 <div className="content">{summary.content}</div>
53 </div>
54 ) : (
55 <></>
56 )}
57 <h1 className="contentTitle">导航</h1>
58 {codes.map((code, index) => (
59 <div
60 className="item code"
61 onClick={() => pinCode(index)}
62 key={index}>
63 <span className="codeTxt">
64 {index + 1}-{JSON.stringify(code)}
65 </span>
66 <PushpinOutlined
67 style={{
68 color: "#52c41a",
69 fontSize: "16px",
70 marginLeft: "10px"
71 }}

Callers

nothing calls this directly

Calls 2

pinCodeFunction · 0.85
downloadCodeFunction · 0.85

Tested by

no test coverage detected