Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
weilirs committed Jul 22, 2024
1 parent 6f18f47 commit 125865d
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const WritingAssistant: React.FC<WritingAssistantProps> = ({
const [prevPrompt, setPrevPrompt] = useState<string>('')
const [positionStyle, setPositionStyle] = useState({ top: 0, left: 0 })
const [markdownMaxHeight, setMarkdownMaxHeight] = useState("auto")

Check failure on line 34 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Replace `"auto"` with `'auto'`

Check failure on line 34 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"auto"` with `'auto'`

Check failure on line 34 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"auto"` with `'auto'`
const markdownContainerRef = useRef(null)
const optionsContainerRef = useRef(null)
const markdownContainerRef = useRef<HTMLDivElement>(null)
const optionsContainerRef = useRef<HTMLDivElement>(null)
const hasValidMessages = currentChatHistory?.displayableChatHistory.some((msg) => msg.role === 'assistant')
const lastAssistantMessage = currentChatHistory?.displayableChatHistory
.filter((msg) => msg.role === 'assistant')
Expand All @@ -56,8 +56,7 @@ const WritingAssistant: React.FC<WritingAssistantProps> = ({
if (!isOptionsVisible) return

const calculatePosition = () => {
if (!optionsContainerRef.current) {
console.log("Ref not attached yet")
if (!optionsContainerRef.current || !highlightData.position) {
return
}

Expand All @@ -79,30 +78,30 @@ const WritingAssistant: React.FC<WritingAssistantProps> = ({
}
}

calculatePosition();
calculatePosition()
}, [isOptionsVisible, highlightData.position])

useLayoutEffect(() => {

Check failure on line 84 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Expected to return a value at the end of arrow function

Check failure on line 84 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Expected to return a value at the end of arrow function

Check failure on line 84 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Expected to return a value at the end of arrow function
if (hasValidMessages && highlightData && highlightData.position) {
if (hasValidMessages && highlightData.position) {
const calculateMaxHeight = () => {
if (!markdownContainerRef.current) return;
if (!markdownContainerRef.current) return

const screenHeight = window.innerHeight;
const containerTop = positionStyle.top;
const buttonHeight = 30;
const padding = 54;
const screenHeight = window.innerHeight
const containerTop = positionStyle.top
const buttonHeight = 30
const padding = 54
const availableHeight =

Check failure on line 93 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Delete `⏎·········`

Check failure on line 93 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Delete `⏎·········`

Check failure on line 93 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Delete `⏎·········`
screenHeight - containerTop - buttonHeight - padding;
screenHeight - containerTop - buttonHeight - padding

setMarkdownMaxHeight(`${availableHeight}px`);
};
setMarkdownMaxHeight(`${availableHeight}px`)
}

calculateMaxHeight();
window.addEventListener("resize", calculateMaxHeight);
calculateMaxHeight()
window.addEventListener("resize", calculateMaxHeight)

Check failure on line 100 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Replace `"resize"` with `'resize'`

Check failure on line 100 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"resize"` with `'resize'`

Check failure on line 100 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"resize"` with `'resize'`

return () => window.removeEventListener("resize", calculateMaxHeight);
return () => window.removeEventListener("resize", calculateMaxHeight)

Check failure on line 102 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Replace `"resize"` with `'resize'`

Check failure on line 102 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"resize"` with `'resize'`

Check failure on line 102 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Replace `"resize"` with `'resize'`
}
}, [hasValidMessages, highlightData]);
}, [hasValidMessages, highlightData])

Check failure on line 104 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

React Hook useLayoutEffect has a missing dependency: 'positionStyle.top'. Either include it or remove the dependency array

Check failure on line 104 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

React Hook useLayoutEffect has a missing dependency: 'positionStyle.top'. Either include it or remove the dependency array

Check failure on line 104 in src/components/Writing-Assistant/WritingAssistantFloatingMenu.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

React Hook useLayoutEffect has a missing dependency: 'positionStyle.top'. Either include it or remove the dependency array

const copyToClipboard = () => {
if (!editor || !currentChatHistory || currentChatHistory.displayableChatHistory.length === 0) {
Expand Down

0 comments on commit 125865d

Please sign in to comment.