Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:docs & delete db role & baidu #4272

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Conversation

zjy365
Copy link
Contributor

@zjy365 zjy365 commented Nov 8, 2023

πŸ€– Generated by Copilot at b200441

Summary

πŸ› οΈπŸ“ˆπŸ–±οΈ

This pull request refactors and enhances the code related to the baidu ads integration. It removes the dotenv module and the BD_TOKEN variable from the website project and moves them to the frontend/desktop project. It adds the bd_vid parameter to the website and the frontend/desktop projects to track the conversion data of the baidu ads. It simplifies and improves some components and hooks in the website project and adds some logging and error handling to the frontend/desktop project. It also updates some dependencies and styles.

BD_TOKEN gone
Tracking baidu ads with bd_vid
Autumn leaves the code

Walkthrough

  • Remove the dotenv module and the BD_TOKEN variable from the website project, as they are no longer needed after moving the BD_TOKEN variable to the frontend/desktop project (link, link, link)
  • Add a new state variable bd_vid and a new useEffect hook to the useWindow custom hook, which are used to store and get the baidu id parameter from the sessionStorage (link, link, link)
  • Modify the logic of setting the cloudUrl state variable in the useWindow custom hook, which is used to determine the url of the cloud platform based on the hostname instead of the language (link)
  • Add the bd_vid state variable to the return value of the useWindow custom hook, so that it can be accessed by other components that use the hook (link)
  • Pass the bd_vid parameter to some links that redirect to the cloud platform or the license platform, which is used to track the conversion data of the baidu ads (link, link, link, link, link, link, link, link, link, link, link)
  • Add the cursor property to the i18nIcon class and the Flex component, which are used to display the language switch icon and the logout icon and text, to improve the user experience and indicate that they are clickable (link, link)
  • Remove the useUploadData custom hook and the related variables and handlers from the Header component, as the conversion data is handled by the frontend/desktop project (link, link, link)
  • Modify the onClick handler of the i18nIcon div in the HomeHeader component, which is used to switch the language of the website, to use the window.location.replace method instead of the Link component, to avoid some issues with the global.js script that intercepts the a tags (link)
  • Remove the unnecessary variables from the Banner and Home components, which are not used in the components (link, link)
  • Modify the href attribute of the start-now-button in the HomeHeader component, which is used to redirect to the cloud platform, to pass the bd_vid parameter, which is used to track the conversion data of the baidu ads (link)
  • Modify the onClick handler of the button in the Product component, which is used to open a new tab to the feishu form, to avoid passing unnecessary parameters (link)
  • Modify the console.log statement in the global.js script, which is used to log some information when the DOM content is loaded, to make it more descriptive and explain the purpose of the script (link)
  • Modify the logic of the global.js script, which is used to intercept the a tags and modify their href attributes based on the hostname and the baidu id, to simplify the code and avoid using multiple replace methods for different domains (link)
  • Add the uploadConvertData function to the platform.ts file, which is used to send the conversion data to the baidu platform (link)
  • Add the call to the uploadConvertData function in the Signin and Callback components, which are used to send the conversion data to the baidu platform when the user signs in successfully (link, link)
  • Remove the console.log statement in the App component, which is used to log the lang variable, which is the current language code (link)
  • Add the console.log statement in the getInstalledApps function, which is used to get the installed apps from the backend, to log the error object that may occur when calling the backend api (link)
  • Add the handler function to the uploadData.ts file, which is used to handle the api request for sending the conversion data to the baidu platform (link)
  • Add the useEffect hook to the Index component, which is used to handle the baidu id parameter from the router query and store it to the sessionStorage (link)
  • Delete the useUploadData.ts file, which is no longer needed after moving the uploadConvertData function to the platform.ts file (link)

Signed-off-by: jingyang <3161362058@qq.com>
Copy link

sweep-ai bot commented Nov 8, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.

@zjy365 zjy365 changed the title fix:docs && delete db role && baidu fix:docs & delete db role & baidu Nov 8, 2023
@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Nov 8, 2023

πŸ€– Generated by lychee action

Summary

Status Count
πŸ” Total 981
βœ… Successful 312
⏳ Timeouts 0
πŸ”€ Redirected 0
πŸ‘» Excluded 668
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

All modified and coverable lines are covered by tests βœ…

πŸ“’ Thoughts on this report? Let us know!

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Nov 8, 2023

πŸ“˜ Preview documentation website

πŸ‘€ Visit Preview

@yangchuansheng yangchuansheng added this to the v5.0 milestone Nov 8, 2023
@yangchuansheng yangchuansheng merged commit 3c8db86 into labring:main Nov 8, 2023
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants