Skip to content

Commit

Permalink
Fix Console Warning in browser [UI/UX Page] [Chats] [Tauri Desktop] (C…
Browse files Browse the repository at this point in the history
…hatGPTNextWeb#112)

* Fix Console Warning in browser [UI/UX Page] [Chats] [Tauri Desktop]

[+] fix(chat.tsx): fix togglePinApp function to only execute if isApp is true
[+] feat(chat.tsx): update pinApp and togglePinApp to handle non-app environments

* Fix CI CodeQL not showing PR number

[+] fix(codeql.yml): add pull request number to the comment message
  • Loading branch information
H0llyW00dzZ committed Nov 16, 2023
1 parent 8d503b0 commit e6be9c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ jobs:
if [ -f "${{ runner.workspace }}/results/javascript.sarif.gpg" ]; then
echo "codeql_status=done" >> $GITHUB_STATE
echo "codeql_status=done" >> $GITHUB_OUTPUT
echo "pull_request_number=${{ github.event.pull_request.number }}" >> $GITHUB_STATE
echo "pull_request_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "codeql_status=pending" >> $GITHUB_STATE
echo "codeql_status=pending" >> $GITHUB_OUTPUT
Expand All @@ -166,5 +168,5 @@ jobs:
if: ${{ steps.check-status.outputs.codeql_status == 'done' && github.event_name == 'pull_request' }}
uses: NejcZdovc/comment-pr@v2
with:
message: "CodeQL analysis is complete for PR `${{ github.event.issue.number }}`"
message: "CodeQL analysis is complete for PR #${{ steps.check-status.outputs.pull_request_number }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 7 additions & 2 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,13 @@ export function EditMessageModal(props: { onClose: () => void }) {

function usePinApp() {
const [pinApp, setPinApp] = useState(false);
const isApp = getClientConfig()?.isApp; // hide tauri console warning in browser

const togglePinApp = async () => {
if (!isApp) {
return;
}

if (pinApp) {
await appWindow.setAlwaysOnTop(false);
sendDesktopNotification(Locale.Chat.Actions.PinAppContent.UnPinned);
Expand All @@ -712,8 +717,8 @@ function usePinApp() {
};

return {
pinApp,
togglePinApp,
pinApp: isApp ? pinApp : false,
togglePinApp: isApp ? togglePinApp : () => {},
};
}

Expand Down

0 comments on commit e6be9c1

Please sign in to comment.