From 9d3a1d81cdb9df048b0b3c81ff7b091a79891ac7 Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Thu, 16 Nov 2023 02:39:12 +0800 Subject: [PATCH] perf: optimize avatar display --- src/app/content/index.tsx | 8 +++---- src/app/content/views/AppContainer/index.tsx | 2 +- src/app/content/views/Header/index.tsx | 22 ++++++++++++++++---- src/components/MessageItem.tsx | 4 ++-- src/hooks/useResizable.ts | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/app/content/index.tsx b/src/app/content/index.tsx index 492f3c7..b9c942e 100644 --- a/src/app/content/index.tsx +++ b/src/app/content/index.tsx @@ -1,5 +1,5 @@ -import ReactDOM from 'react-dom/client' import React from 'react' +import { createRoot } from 'react-dom/client' import { Remesh } from 'remesh' import { RemeshRoot } from 'remesh-react' import { RemeshLogger } from 'remesh-logger' @@ -12,15 +12,15 @@ export default defineContentScript({ matches: ['*://*.example.com/*', '*://*.google.com/*', '*://*.v2ex.com/*'], async main(ctx) { const store = Remesh.store({ - externs: [StorageImpl] - // inspectors: [RemeshLogger()] + externs: [StorageImpl], + inspectors: [RemeshLogger()] }) const ui = await createContentScriptUi(ctx, { name: __NAME__, type: 'overlay', mount(container) { - const root = ReactDOM.createRoot(container) + const root = createRoot(container) root.render( diff --git a/src/app/content/views/AppContainer/index.tsx b/src/app/content/views/AppContainer/index.tsx index c30c1f4..1c80dd1 100644 --- a/src/app/content/views/AppContainer/index.tsx +++ b/src/app/content/views/AppContainer/index.tsx @@ -17,7 +17,7 @@ const AppContainer: FC = ({ children }) => { style={{ width: `${size}px` }} - className="fixed bottom-10 right-10 top-5 z-top box-border grid grid-flow-col grid-rows-[auto_1fr_auto] rounded-xl bg-slate-50 font-sans shadow-2xl" + className="fixed bottom-10 right-10 top-5 z-top box-border grid min-h-[375px] grid-flow-col grid-rows-[auto_1fr_auto] rounded-xl bg-slate-50 font-sans shadow-2xl" > {children}
{ const websiteInfo = getWebSiteInfo() return ( -
- +
+ + + + + +