Repository: hzeyuan/x-cards Branch: master Commit: a6c94888a84f Files: 125 Total size: 476.8 KB Directory structure: gitextract_nbnj719d/ ├── .github/ │ └── workflows/ │ └── submit.yml ├── .gitignore ├── .prettierrc.mjs ├── LICENSE ├── README.md ├── README_ZH.md ├── components/ │ └── ui/ │ ├── EditableButton.tsx │ ├── accordion.tsx │ ├── alert-dialog.tsx │ ├── badge.tsx │ ├── button.tsx │ ├── color-picker.tsx │ ├── dropdown-menu.tsx │ ├── input.tsx │ ├── popover.tsx │ ├── radio-group.tsx │ ├── select-position.tsx │ ├── select.tsx │ ├── slider.tsx │ ├── sonner.tsx │ ├── switch.tsx │ ├── tabs.tsx │ ├── textarea.tsx │ ├── toast.tsx │ ├── toaster.tsx │ └── use-toast.ts ├── components.json ├── lib/ │ └── utils.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── popup.tsx ├── postcss.config.js ├── src/ │ ├── app/ │ │ ├── (app)/ │ │ │ ├── components/ │ │ │ │ ├── FrequentlyAskedQuestions.tsx │ │ │ │ ├── GoogleFontSelector.tsx │ │ │ │ ├── ImageLayout.tsx │ │ │ │ ├── LazyLoadAnimatedSection.tsx │ │ │ │ ├── ResultIcon.tsx │ │ │ │ ├── card-generator/ │ │ │ │ │ ├── color.tsx │ │ │ │ │ ├── controller/ │ │ │ │ │ │ ├── background-controller.tsx │ │ │ │ │ │ ├── card-controller.tsx │ │ │ │ │ │ ├── font-controller.tsx │ │ │ │ │ │ ├── iframe-controller.tsx │ │ │ │ │ │ └── input-controller.tsx │ │ │ │ │ ├── display.tsx │ │ │ │ │ ├── export-tab.tsx │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── twitter-card.tsx │ │ │ │ │ └── wechat-card.tsx │ │ │ │ ├── dynamic-style-tippy.tsx │ │ │ │ ├── hero.tsx │ │ │ │ ├── save-as-template-button.tsx │ │ │ │ ├── sections/ │ │ │ │ │ ├── FeaturesGridSection.tsx │ │ │ │ │ ├── features2.tsx │ │ │ │ │ ├── footer.tsx │ │ │ │ │ └── video.tsx │ │ │ │ ├── template-list.tsx │ │ │ │ └── x-form.tsx │ │ │ ├── layout.tsx │ │ │ ├── page.tsx │ │ │ └── request.tsx │ │ ├── (extension)/ │ │ │ ├── independent/ │ │ │ │ ├── components/ │ │ │ │ │ └── index.tsx │ │ │ │ └── page.tsx │ │ │ └── welcome/ │ │ │ └── page.tsx │ │ ├── api/ │ │ │ ├── license/ │ │ │ │ └── route.ts │ │ │ └── x/ │ │ │ └── route.ts │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── utils/ │ │ ├── IFrameMessageSystem.ts │ │ ├── element.ts │ │ ├── export.ts │ │ ├── format.ts │ │ ├── image.ts │ │ └── index.ts │ ├── background/ │ │ ├── index.ts │ │ └── messages/ │ │ ├── code.ts │ │ └── tweet.ts │ ├── components/ │ │ ├── extension/ │ │ │ ├── card-button.tsx │ │ │ ├── input-code.tsx │ │ │ ├── label-with-icon.tsx │ │ │ ├── layout-options.tsx │ │ │ ├── preset-color-list.tsx │ │ │ ├── tabs.tsx │ │ │ ├── tweet-manager.tsx │ │ │ ├── use-tweet-collection.ts │ │ │ └── x-cards-toast/ │ │ │ ├── font-control.tsx │ │ │ ├── image-preview.tsx │ │ │ ├── index.module.css │ │ │ ├── index.tsx │ │ │ ├── padding-control.tsx │ │ │ ├── scale-control.tsx │ │ │ └── tweet-control.tsx │ │ ├── sortableList.tsx │ │ └── ui/ │ │ ├── BentoGrid.tsx │ │ ├── DotPattern.tsx │ │ ├── acetenity-tabs.tsx │ │ ├── animated-list.tsx │ │ ├── animatedBeam.tsx │ │ ├── api-key-panel.tsx │ │ ├── bold-copy.tsx │ │ ├── burnIn.tsx │ │ ├── card.tsx │ │ ├── chart.tsx │ │ ├── fade-text.tsx │ │ ├── grid-pattern.tsx │ │ ├── grid.tsx │ │ ├── icon.tsx │ │ ├── loading-spinner.tsx │ │ ├── marquee.tsx │ │ ├── scroll-based-velocity.tsx │ │ ├── shimmer-button.tsx │ │ ├── text-generate-effect.tsx │ │ └── underline-hover-text.tsx │ ├── config/ │ │ └── site.ts │ ├── contents/ │ │ ├── plasmo-overlay.css │ │ ├── plasmo-overlay.tsx │ │ ├── x-home.tsx │ │ └── x.css │ ├── hooks/ │ │ ├── useCardStore.tsx │ │ └── useTemplatesStore.tsx │ ├── lib/ │ │ └── BlurGradientBg.module.js │ └── sandbox.tsx ├── tailwind.config.ts ├── tsconfig.json └── vercel.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/submit.yml ================================================ name: "Submit to Web Store" on: workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Cache pnpm modules uses: actions/cache@v3 with: path: ~/.pnpm-store key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- - uses: pnpm/action-setup@v2.2.4 with: version: latest run_install: true - name: Use Node.js 16.x uses: actions/setup-node@v3.4.1 with: node-version: 16.x cache: "pnpm" - name: Build the extension run: pnpm build - name: Package the extension into a zip artifact run: pnpm package - name: Browser Platform Publish uses: PlasmoHQ/bpp@v3 with: keys: ${{ secrets.SUBMIT_KEYS }} artifact: build/chrome-mv3-prod.zip ================================================ FILE: .gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # misc .DS_Store *.pem # debug npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* # local env files .env*.local out/ build/ dist/ # plasmo .plasmo # typescript .tsbuildinfo .next ================================================ FILE: .prettierrc.mjs ================================================ /** * @type {import('prettier').Options} */ export default { printWidth: 80, tabWidth: 2, useTabs: false, semi: false, singleQuote: false, trailingComma: "none", bracketSpacing: true, bracketSameLine: true, plugins: ["@ianvs/prettier-plugin-sort-imports"], importOrder: [ "", // Node.js built-in modules "", // Imports not matched by other special words or groups. "", // Empty line "^@plasmo/(.*)$", "", "^@plasmohq/(.*)$", "", "^~(.*)$", "", "^[./]" ] } ================================================ FILE: LICENSE ================================================ Mozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================ FILE: README.md ================================================

X Cards

[English](README.md) | [中文](README_ZH.md) [![x-cards intro](https://img.youtube.com/vi/v8iQV8ZoVBk/0.jpg)](https://youtu.be/okCIZrFrTCE) easy to use x-cards in x.com [![][vercel-shield]][vercel-link] [![][share-x-shield]][share-x-link] [![][share-whatsapp-shield]][share-whatsapp-link] [![][share-reddit-shield]][share-reddit-link] [![][share-weibo-shield]][share-weibo-link] [![][share-linkedin-shield]][share-linkedin-link] [github-issues-link]: https://github.com/hzeyuan/x-cards/issues [github-contributors-shield]: https://img.shields.io/github/contributors/hzeyuan/OpenGPTS?color=c4f042&labelColor=black&style=flat-square [github-contributors-link]: https://github.com/hzeyuan/OpenGPTS/graphs/contributors [vercel-link]: https://x-cards.net [vercel-shield]: https://img.shields.io/website?down_message=offline&label=vercel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https://x-cards.net [share-linkedin-link]: https://linkedin.com/feed [share-linkedin-shield]: https://img.shields.io/badge/-share%20on%20linkedin-black?labelColor=black&logo=linkedin&logoColor=white&style=flat-square [share-reddit-link]: https://www.reddit.com/submit?title=x-cards&url=https://github.com/hzeyuan/x-cards [share-reddit-shield]: https://img.shields.io/badge/-share%20on%20reddit-black?labelColor=black&logo=reddit&logoColor=white&style=flat-square [share-telegram-link]: https://t.me/share/url?text=x-cards&url=https://github.com/hzeyuan/x-cards [share-telegram-shield]: https://img.shields.io/badge/-share%20on%20telegram-black?labelColor=black&logo=telegram&logoColor=white&style=flat-square [share-weibo-link]: http://service.weibo.com/share/share.php?sharesource=weibo&title=x-cards [share-weibo-shield]: https://img.shields.io/badge/-share%20on%20weibo-black?labelColor=black&logo=sinaweibo&logoColor=white&style=flat-square [share-whatsapp-link]: https://api.whatsapp.com/send?text=x-cards [share-whatsapp-shield]: https://img.shields.io/badge/-share%20on%20whatsapp-black?labelColor=black&logo=whatsapp&logoColor=white&style=flat-square [share-x-link]: https://x.com/intent/tweet?hashtags=chatbot%2CchatGPT%2CopenAI&url=https://github.com/hzeyuan/x-cards [share-x-shield]: https://img.shields.io/badge/-share%20on%20x-black?labelColor=black&logo=x&logoColor=white&style=flat-square
⚡ **X Cards** Share Tweet anywhere ,any format, ## Project Background X is a source of information for many platforms,So this project came into being ## Changelog
v0.0.3 * Performance Optimization: Utilized web workers for image generation, addressing issues with blank spaces on X.com after scrolling down. * Enhanced Padding Settings: Added the ability to adjust padding within the card for better layout control. * Image Quality Settings: Introduced options to set the quality of generated images for export. * Markdown Export: Now supports exporting content in Markdown format for easy integration into documentation or blogs. * Font Size Adjustment: Added support for modifying font sizes to improve readability and customization. * Interaction Optimization: After installing the plugin or clicking the icon, redirect to the welcome page. ![Download Extension](./assets/v0.02-demo.jpg)
v0.0.2 - Added real-time preview feature, now a toast in the upper right corner allows you to observe the generated card. - Introduced customization for card background color. - Customizable card width. - Improved: Now clicking defaults to copying the image, rather than downloading the image. - Fixed the issue of unable to fetch cover image for videos. - Added support for fetching continuous posts. - Enabled dynamic addition, deletion, dragging, and management of posts. ![Download Extension](./assets/v0.02-demo.jpg)
v0.0.1 - Easy to access, just a simple click away. - Obtain videos, images, text, likes。 - Export in multiple formats, including JSON, Markdown, PNG, JPEG, and SVG.
## features - Added real-time preview feature, now a toast in the upper right corner allows you to observe the generated card. - Introduced customization for card background color. - Customizable card width. - Improved: Now clicking defaults to copying the image, rather than downloading the image. - Fixed the issue of unable to fetch cover image for videos. - Added support for fetching continuous posts. - Enabled dynamic addition, deletion, dragging, and management of posts.
## How to Use ### [chrome web Store](https://chromewebstore.google.com/detail/x-card/mbinooofmcjhjklihfejnkkebffceeop) ## or 1. Download Extension ![Download Extension](./assets/install_guide/1.download.png) 2. url input:chrome://extensions/ in your chrome browser, and open the developer mode 3. unzip and Drag the extension file to the page ![Drag the extension file to the page](./assets/install_guide/2.install.png) 4. open x.com and browse the post, you will find your card button in the bottom right corner ## Development Guide 1. The project uses the Plasmo framework for rapid Chrome extension development. 2. Uses Next.js for frontend development. 3. Tailwind CSS and Shadcn as CSS frameworks. 4. Langchain for developing agents. 5. Deployed on Vercel. Local development: ```bash pnpm install # Run frontend npm run dev:next # Run plugin npm run dev:plasmo ``` ## Starchart [![Star History Chart](https://api.star-history.com/svg?repos=hzeyuan/x-cards&type=Date)](https://star-history.com/#hzeyuan/x-cards&Date) ================================================ FILE: README_ZH.md ================================================

X Cards

[English](README.md) | [中文](README_ZH.md) [![x-cards intro](https://img.youtube.com/vi/v8iQV8ZoVBk/0.jpg)](https://www.youtube.com/watch?v=v8iQV8ZoVBk) 轻松的X平台上使用x-cards [![][vercel-shield]][vercel-link] [![][share-x-shield]][share-x-link] [![][share-whatsapp-shield]][share-whatsapp-link] [![][share-reddit-shield]][share-reddit-link] [![][share-weibo-shield]][share-weibo-link] [![][share-linkedin-shield]][share-linkedin-link] [github-issues-link]: https://github.com/hzeyuan/x-cards/issues [github-contributors-shield]: https://img.shields.io/github/contributors/hzeyuan/OpenGPTS?color=c4f042&labelColor=black&style=flat-square [github-contributors-link]: https://github.com/hzeyuan/OpenGPTS/graphs/contributors [vercel-link]: https://x-cards.net [vercel-shield]: https://img.shields.io/website?down_message=offline&label=vercel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https://x-cards.net [share-linkedin-link]: https://linkedin.com/feed [share-linkedin-shield]: https://img.shields.io/badge/-share%20on%20linkedin-black?labelColor=black&logo=linkedin&logoColor=white&style=flat-square [share-reddit-link]: https://www.reddit.com/submit?title=x-cards&url=https://github.com/hzeyuan/x-cards [share-reddit-shield]: https://img.shields.io/badge/-share%20on%20reddit-black?labelColor=black&logo=reddit&logoColor=white&style=flat-square [share-telegram-link]: https://t.me/share/url?text=x-cards&url=https://github.com/hzeyuan/x-cards [share-telegram-shield]: https://img.shields.io/badge/-share%20on%20telegram-black?labelColor=black&logo=telegram&logoColor=white&style=flat-square [share-weibo-link]: http://service.weibo.com/share/share.php?sharesource=weibo&title=x-cards [share-weibo-shield]: https://img.shields.io/badge/-share%20on%20weibo-black?labelColor=black&logo=sinaweibo&logoColor=white&style=flat-square [share-whatsapp-link]: https://api.whatsapp.com/send?text=x-cards [share-whatsapp-shield]: https://img.shields.io/badge/-share%20on%20whatsapp-black?labelColor=black&logo=whatsapp&logoColor=white&style=flat-square [share-x-link]: https://x.com/intent/tweet?hashtags=chatbot%2CchatGPT%2CopenAI&url=https://github.com/hzeyuan/x-cards [share-x-shield]: https://img.shields.io/badge/-share%20on%20x-black?labelColor=black&logo=x&logoColor=white&style=flat-square
⚡ **X Cards** Share X anywhere ,any format, ## 项目背景 X是许多平台的信息来源,因此产生了这个项目。 ## Changelog
v0.0.3 - 优化性能,使用web worker生成图片, 处理下拉后x.com空白问题。 - 增加padding设置,调整卡片内边距。 - 增加生成图片质量设置。 - 增加md格式导出。 - 支持调整字体大小。 - 交互优化,安装插件后或者,点击icon,跳转到welcome页面。
v0.0.2 - 新增实时预览功能,现在右上角有个toast可以观察到生成的卡片。 - 引入了自定义卡片背景颜色。 - 可自定义卡片宽度。 - 改进:现在点击默认复制图片,而不是下载图片。 - 修复了视频获取封面图的问题。 - 增加了连续帖子获取的支持。 - 实现了帖子的动态添加、删除、拖拽和管理。
v0.0.1 - 点击即可轻松访问。 - 获取视频、图片、文本、点赞等。 - 导出多种格式,包括JSON、Markdown、PNG、JPEG和SVG。
## features - 简单易用,只需点击一下即生成卡片。 - 轻松获取视频、图片、文字、点赞和浏览历史。 - 支持多种格式导出,包括JSON、Markdown、PNG、JPEG和SVG。 - 模板功能,保存您经常使用的卡片样式。
## How to Use 1. 点击下载插件 ![Download Extension](./assets/install_guide/1.download.png) 2. 浏览器输入 chrome://extensions/ 并打开开发者模式 3. 解压并,拖动整个文件夹到页面,如图: ![Drag the extension file to the page](./assets/install_guide/2.install.png) 4. 打开x.com并浏览帖子,您将在右下角找到您的卡片按钮,参考上方视频。 ## 开发指南 本项目使用 Plasmo 框架进行快速 Chrome 扩展开发。 使用 Next.js 进行前端开发。 采用 Tailwind CSS 和 Shadcn 作为 CSS 框架。 使用 Langchain 开发智能代理。 部署在 Vercel 平台上。 Local development: ```bash pnpm install # Run frontend npm run dev:next # Run plugin npm run dev:plasmo ``` ## Starchart [![Star History Chart](https://api.star-history.com/svg?repos=hzeyuan/x-cards&type=Date)](https://star-history.com/#hzeyuan/x-cards&Date) ================================================ FILE: components/ui/EditableButton.tsx ================================================ import React, { useState, useRef } from 'react'; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; const EditableButton = ({ text }) => { const [isEditing, setIsEditing] = useState(false); const [value, setValue] = useState(text); const inputRef = useRef(null); const handleClick = () => { if (!isEditing) { setIsEditing(true); setTimeout(() => inputRef.current?.focus(), 0); } else { setIsEditing(false); // 在这里可以添加保存或提交的逻辑 console.log('Submitted:', value); } }; const handleChange = (e) => { setValue(e.target.value); }; const handleKeyDown = (e) => { if (e.key === 'Enter') { handleClick(); } }; return (
{isEditing ? ( ) : ( )} {isEditing && ( )}
); }; export default EditableButton; ================================================ FILE: components/ui/accordion.tsx ================================================ "use client" import * as React from "react" import * as AccordionPrimitive from "@radix-ui/react-accordion" import { ChevronDown } from "lucide-react" import { cn } from "@/lib/utils" const Accordion = AccordionPrimitive.Root const AccordionItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AccordionItem.displayName = "AccordionItem" const AccordionTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( svg]:rotate-180", className )} {...props} > {children} )) AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName const AccordionContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => (
{children}
)) AccordionContent.displayName = AccordionPrimitive.Content.displayName export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } ================================================ FILE: components/ui/alert-dialog.tsx ================================================ "use client" import * as React from "react" import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" import { cn } from "@/lib/utils" import { buttonVariants } from "@/components/ui/button" const AlertDialog = AlertDialogPrimitive.Root const AlertDialogTrigger = AlertDialogPrimitive.Trigger const AlertDialogPortal = AlertDialogPrimitive.Portal const AlertDialogOverlay = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName const AlertDialogContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes) => (
) AlertDialogHeader.displayName = "AlertDialogHeader" const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes) => (
) AlertDialogFooter.displayName = "AlertDialogFooter" const AlertDialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName const AlertDialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName const AlertDialogAction = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName const AlertDialogCancel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, } ================================================ FILE: components/ui/badge.tsx ================================================ import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const badgeVariants = cva( "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", outline: "text-foreground", }, }, defaultVariants: { variant: "default", }, } ) export interface BadgeProps extends React.HTMLAttributes, VariantProps {} function Badge({ className, variant, ...props }: BadgeProps) { return (
) } export { Badge, badgeVariants } ================================================ FILE: components/ui/button.tsx ================================================ import * as React from "react" import { Slot } from "@radix-ui/react-slot" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const buttonVariants = cva( "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", { variants: { variant: { default: "bg-primary text-primary-foreground hover:bg-primary/90", destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", link: "text-primary underline-offset-4 hover:underline", }, size: { default: "h-10 px-4 py-2", sm: "h-9 rounded-md px-3", lg: "h-11 rounded-md px-8", icon: "h-10 w-10", }, }, defaultVariants: { variant: "default", size: "default", }, } ) export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean } const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button" return ( ) } ) Button.displayName = "Button" export { Button, buttonVariants } ================================================ FILE: components/ui/color-picker.tsx ================================================ 'use client'; import { forwardRef, useEffect, useMemo, useRef, useState } from 'react'; import { HexColorPicker } from 'react-colorful'; import { cn } from '@/lib/utils'; import type { ButtonProps } from '@/components/ui/button'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { PopoverContent, PopoverTrigger, Popover } from './popover'; export function useForwardedRef(ref: React.ForwardedRef) { const innerRef = useRef(null); useEffect(() => { if (!ref) return; if (typeof ref === 'function') { ref(innerRef.current); } else { ref.current = innerRef.current; } }); return innerRef; } interface ColorPickerProps { value: string; onChange: (value: string) => void; onBlur?: () => void; } const ColorPicker = forwardRef< HTMLInputElement, Omit & ColorPickerProps >( ( { disabled, value, onChange, onBlur, name, className, ...props }, forwardedRef ) => { const ref = useForwardedRef(forwardedRef); const [open, setOpen] = useState(false); const parsedValue = useMemo(() => { return value || '#FFFFFF'; }, [value]); return ( { onChange(e?.currentTarget?.value); }} ref={ref} value={parsedValue} /> ); } ); ColorPicker.displayName = 'ColorPicker'; export { ColorPicker }; ================================================ FILE: components/ui/dropdown-menu.tsx ================================================ "use client" import * as React from "react" import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" import { Check, ChevronRight, Circle } from "lucide-react" import { cn } from "@/lib/utils" const DropdownMenu = DropdownMenuPrimitive.Root const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger const DropdownMenuGroup = DropdownMenuPrimitive.Group const DropdownMenuPortal = DropdownMenuPrimitive.Portal const DropdownMenuSub = DropdownMenuPrimitive.Sub const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup const DropdownMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean } >(({ className, inset, children, ...props }, ref) => ( {children} )) DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName const DropdownMenuSubContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName const DropdownMenuContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, sideOffset = 4, ...props }, ref) => ( )) DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName const DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean } >(({ className, inset, ...props }, ref) => ( )) DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, checked, ...props }, ref) => ( {children} )) DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName const DropdownMenuRadioItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )) DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName const DropdownMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean } >(({ className, inset, ...props }, ref) => ( )) DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName const DropdownMenuSeparator = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes) => { return ( ) } DropdownMenuShortcut.displayName = "DropdownMenuShortcut" export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, } ================================================ FILE: components/ui/input.tsx ================================================ import * as React from "react" import { cn } from "@/lib/utils" export interface InputProps extends React.InputHTMLAttributes {} const Input = React.forwardRef( ({ className, type, ...props }, ref) => { return ( ) } ) Input.displayName = "Input" export { Input } ================================================ FILE: components/ui/popover.tsx ================================================ "use client" import * as React from "react" import * as PopoverPrimitive from "@radix-ui/react-popover" import { cn } from "@/lib/utils" const Popover = PopoverPrimitive.Root const PopoverTrigger = PopoverPrimitive.Trigger const PopoverContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( )) PopoverContent.displayName = PopoverPrimitive.Content.displayName export { Popover, PopoverTrigger, PopoverContent } ================================================ FILE: components/ui/radio-group.tsx ================================================ "use client" import * as React from "react" import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" import { Circle } from "lucide-react" import { cn } from "@/lib/utils" const RadioGroup = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => { return ( ) }) RadioGroup.displayName = RadioGroupPrimitive.Root.displayName const RadioGroupItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => { return ( ) }) RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName export { RadioGroup, RadioGroupItem } ================================================ FILE: components/ui/select-position.tsx ================================================ "use client" import { cn } from "@lib/utils" import { useState } from "react" export const SelectBackgroundPosition = ({ onChange }) => { const [position, setPosition] = useState('center center') const positions = [ { value: "left top", title: "Top left" }, { value: "center top", title: "Top center" }, { value: "right top", title: "Top right" }, { value: "left center", title: "Left center" }, { value: "center center", title: "Center" }, { value: "right center", title: "Right center" }, { value: "left bottom", title: "Bottom left" }, { value: "center bottom", title: "Bottom center" }, { value: "right bottom", title: "Bottom right" } ] const handleClick = (newPosition) => { setPosition(newPosition) onChange(newPosition) } return (
{positions.map(({ value, title }) => (
handleClick(value)} title={title} className={cn( "w-[8px] h-[8px] rounded-full cursor-pointer", position === value ? "bg-gray-800 dark:bg-gray-200" : "bg-gray-300 hover:bg-gray-500 dark:hover:bg-gray-400 dark:bg-gray-600/50" )} /> ))}
) } ================================================ FILE: components/ui/select.tsx ================================================ "use client" import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" import { Check, ChevronDown, ChevronUp } from "lucide-react" import { cn } from "@/lib/utils" const Select = SelectPrimitive.Root const SelectGroup = SelectPrimitive.Group const SelectValue = SelectPrimitive.Value const SelectTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( span]:line-clamp-1", className )} {...props} > {children} )) SelectTrigger.displayName = SelectPrimitive.Trigger.displayName const SelectScrollUpButton = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName const SelectScrollDownButton = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName const SelectContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, position = "popper", ...props }, ref) => ( {children} )) SelectContent.displayName = SelectPrimitive.Content.displayName const SelectLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectLabel.displayName = SelectPrimitive.Label.displayName const SelectItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )) SelectItem.displayName = SelectPrimitive.Item.displayName const SelectSeparator = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectSeparator.displayName = SelectPrimitive.Separator.displayName export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, } ================================================ FILE: components/ui/slider.tsx ================================================ "use client" import * as React from "react" import * as SliderPrimitive from "@radix-ui/react-slider" import { cn } from "@/lib/utils" const Slider = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( {/* bg-secondary */} )) Slider.displayName = SliderPrimitive.Root.displayName export { Slider } ================================================ FILE: components/ui/sonner.tsx ================================================ "use client" import { useTheme } from "next-themes" import { Toaster as Sonner } from "sonner" type ToasterProps = React.ComponentProps const Toaster = ({ ...props }: ToasterProps) => { const { theme = "system" } = useTheme() return ( ) } export { Toaster } ================================================ FILE: components/ui/switch.tsx ================================================ "use client" import * as React from "react" import * as SwitchPrimitives from "@radix-ui/react-switch" import { cn } from "@/lib/utils" const Switch = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) Switch.displayName = SwitchPrimitives.Root.displayName export { Switch } ================================================ FILE: components/ui/tabs.tsx ================================================ "use client" import * as React from "react" import * as TabsPrimitive from "@radix-ui/react-tabs" import { cn } from "@/lib/utils" const Tabs = TabsPrimitive.Root const TabsList = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) TabsList.displayName = TabsPrimitive.List.displayName const TabsTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) TabsTrigger.displayName = TabsPrimitive.Trigger.displayName const TabsContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) TabsContent.displayName = TabsPrimitive.Content.displayName export { Tabs, TabsList, TabsTrigger, TabsContent } ================================================ FILE: components/ui/textarea.tsx ================================================ import * as React from "react" import { cn } from "@/lib/utils" export interface TextareaProps extends React.TextareaHTMLAttributes {} const Textarea = React.forwardRef( ({ className, ...props }, ref) => { return (
) } ================================================ FILE: src/app/(app)/components/card-generator/display.tsx ================================================ import { CommonLayouts, useCardStore } from "@src/hooks/useCardStore" import { useMemo } from "react" import { presets } from "./color" import { TwitterCard } from "./twitter-card" import { WeChatCard } from "./wechat-card" export const Display = () => { const colorIndex = useCardStore((state) => state.colorIndex) const cardStyles = useCardStore((state) => state.cardStyles) const tabConfig = useCardStore((state) => state.tabConfig); const backgroundStyles = useCardStore((state) => state.backgroundStyles) const xConfig = useCardStore((state) => state.xConfig) const finalBackgroundStyles = useMemo(() => { const color = presets[colorIndex] let borderRadius = cardStyles.borderRadius; if (backgroundStyles.padding === 0) { borderRadius = 0; } if (backgroundStyles?.useGradient) { return { ...backgroundStyles, borderRadius, backgroundImage: `linear-gradient(${backgroundStyles.backgroundGradientAngle}deg, ${backgroundStyles.backgroundStartColor}, ${backgroundStyles.backgroundEndColor})`, } } if (tabConfig.openCustomColor) { return { ...backgroundStyles, borderRadius, backgroundColor: backgroundStyles.backgroundColor, } } if (color.backgroundFillType === "Linear") { return { ...backgroundStyles, borderRadius, backgroundImage: `linear-gradient(${color.backgroundAngle}deg, ${color.backgroundStartColor}, ${color.backgroundEndColor})`, backgroundRepeat: "no-repeat", } } else if (color.backgroundFillType === "Radial") { return { ...backgroundStyles, borderRadius, backgroundImage: `radial-gradient(${color.backgroundStartColor}, ${color.backgroundEndColor})`, backgroundRepeat: "no-repeat", backgroundPosition: color.backgroundPosition, } } else { return { ...backgroundStyles, borderRadius, } } }, [colorIndex, backgroundStyles, tabConfig.openCustomColor]) const calculateScale = (width, height) => { const maxWidth = 1920 / 2; // Maximum width of the card in the display const maxHeight = 1080 / 2; // Maximum height of the card in the display const widthScale = maxWidth / width; const heightScale = maxHeight / height; return Math.min(widthScale, heightScale); }; return (
{/* */}
) } ================================================ FILE: src/app/(app)/components/card-generator/export-tab.tsx ================================================ import { AccordionContent, AccordionItem, AccordionTrigger } from "@components/ui/accordion"; import { Button } from "@components/ui/button"; import { exportImage } from "@src/app/utils/export"; export const ExportTab = () => { return ( Export ) } ================================================ FILE: src/app/(app)/components/card-generator/index.tsx ================================================ import { Accordion, } from "@components/ui/accordion"; import { Display } from "./display"; import { useCardStore } from "@src/hooks/useCardStore"; import { BackgroundController } from "./controller/background-controller"; import { FontController } from "./controller/font-controller"; import { ExportTab } from "./export-tab"; import { Button } from "@components/ui/button"; import { InputController } from "./controller/input-controller"; import { SaveAsTemplateButton } from "../save-as-template-button"; import { CardController } from "./controller/card-controller"; export const CardGenerator = () => { const resetAll = useCardStore((state) => state.resetAll); return (
) } ================================================ FILE: src/app/(app)/components/card-generator/twitter-card.tsx ================================================ import React, { useMemo, useState } from 'react'; import { cn } from '@/lib/utils'; // Assuming you have a utility for class names import ImageLayout from '../ImageLayout'; import XLogo from '@assets/x-logo.svg'; import * as _ from "lodash-es" import { formatTimestamp } from '@src/app/utils/format'; import type { CardStore, XConfig } from '@src/hooks/useCardStore'; interface TwitterCardProps { xConfig: XConfig[], backgroundStyles: CardStore['backgroundStyles'], cardStyles: CardStore['cardStyles'], } export const TwitterCard: React.FC = ({ xConfig, backgroundStyles, cardStyles }) => { const card = useMemo(() => { const controls = cardStyles.controls; return (
{ xConfig.map((config, index) => (
{controls.showFooter && ()}
)) }
∙ Made with x-cards.net
) }, [backgroundStyles, xConfig, cardStyles]); return (
{/* Background layers */} {/* Card container */}
{/* Card body */}
{card}
); }; const BackgroundLayers = ({ backgroundStyles, cardStyles }) => ( <>
{backgroundStyles?.backgroundImage && (
)} {cardStyles.hasNoiseTexture && (
)} ); const CardHeader: React.FC<{ xConfig: XConfig, controls: CardStore['cardStyles']['controls'], }> = ({ xConfig, controls }) => { return (
{controls.showUser ? (
Profile image
{xConfig.username}
) :
} { controls.showLogo ? : <> }
); } const CardLogo = ({ xConfig }) => { return (
) } const Watermark = () => { } const CardBody: React.FC<{ xConfig: XConfig, cardStyles: CardStore['cardStyles'], }> = ({ xConfig, cardStyles }) => { // cardStyles.imageLayout || const layout = xConfig.images.length >= 2 ? 'grid4' : 'vertical'; const images = _.compact( [ ...xConfig.images, xConfig?.video?.poster, ...(xConfig?.links?.map((link) => link.src) || []), ] ) return (
{xConfig.text}
{images && images.length > 0 && ( )}
) } const CardFooter = ({ xConfig }) => { const time = _.isArray(xConfig) ? _.last(xConfig).time : xConfig.time; return (
{formatTimestamp(time)}
{['replies', 'shares', 'likes'].map((stat) => (
{xConfig[stat]} {" "} {stat}
))}
); } ================================================ FILE: src/app/(app)/components/card-generator/wechat-card.tsx ================================================ import type { CardStore, XConfig } from "@src/hooks/useCardStore" interface WechatCardProps { xConfig: XConfig, backgroundStyles: CardStore['backgroundStyles'], cardStyles: CardStore['cardStyles'], fontStyles: CardStore['fontStyles'], } export const WeChatCard: React.FC = () => { return (

Space

摘录于2024/8/18

人性和商业的能力,这样才能更好地发现市场痛点,了解用户需求,并用商业来完善产品想法,而不是仅仅作为一名员工去实现公司指定的产品路线。很多产品经理的工作多年间都无法得到进一步提升,其实相当一部分人是卡在了商业洞察这一块。于是很多人在问,是不是多读几本书就可以系统训练商业知识和商业嗅觉,从而增强自己的商业洞察能力?

/产品之旅:产品经理的方法论与实战进阶

赖京露

微信读书

) } ================================================ FILE: src/app/(app)/components/dynamic-style-tippy.tsx ================================================ import Tippy from "@tippyjs/react"; import { useEffect, useRef } from "react"; export const DynamicStyleTippyComponent = ({ children, content, tippyOptions = {} }) => { const styleId = 'x-cards-dropdown-styles'; const tippyRef = useRef(null); useEffect(() => { // Check if the style element already exists let styleElement = document.getElementById(styleId); if (!styleElement) { // If it doesn't exist, create it styleElement = document.createElement('style'); styleElement.id = styleId; document.head.appendChild(styleElement); } // Define your styles const styles = ` .tippy-box[data-theme~='custom'] { --background: 240 10% 3.9%; --foreground: 0 0% 98%; --muted: 240 3.7% 15.9%; --muted-foreground: 240 5% 64.9%; --popover: 240 10% 3.9%; --popover-foreground: 0 0% 98%; --card: 240 10% 3.9%; --card-foreground: 0 0% 98%; --border: 240 3.7% 15.9%; --input: 240 3.7% 15.9%; --primary: 0 0% 98%; --primary-foreground: 240 5.9% 10%; --secondary: 240 3.7% 15.9%; --secondary-foreground: 0 0% 98%; --accent: 240 3.7% 15.9%; --accent-foreground: 0 0% 98%; --destructive: 0 62.8% 30.6%; --destructive-foreground: 0 0% 98%; --ring: 240 4.9% 83.9%; background-color: black; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); border-radius: 6px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; overflow: hidden; animation: scaleIn 0.2s ease-out; } .tippy-box[data-theme~='custom'] .tippy-content { padding: 4px; min-width: 152px; } .tippy-box[data-theme~='custom'] .dropdown-menu-list { list-style-type: none; padding: 0; margin: 0; } .tippy-box[data-theme~='custom'] .dropdown-menu-item { display: flex; align-items: center; padding: 8px 12px; font-size: 14px; color: hsl(var(--foreground)); cursor: pointer; transition: background-color 0.2s, color 0.2s; border-radius: 4px; user-select: none; } .tippy-box[data-theme~='custom'] .dropdown-menu-item:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); } .tippy-box[data-theme~='custom'] .dropdown-menu-item.no-hover:hover { background-color: transparent; color: hsl(var(--foreground)); } .tippy-box[data-theme~='custom'] .dropdown-menu-item:active { background-color: hsl(var(--muted)); } .tippy-box[data-theme~='custom'] .dropdown-menu-icon { width: 16px; height: 16px; margin-right: 8px; color: var(--muted-foreground); transition: color 0.2s; } .tippy-box[data-theme~='custom'] .dropdown-menu-icon:hover { color: hsl(var(--accent-foreground)); } .tippy-box[data-theme~='custom'] .dropdown-menu-separator { display: flex; align-items: center; text-align: center; // margin: 10px 0; } .tippy-box[data-theme~='custom'] .dropdown-menu-separator::before, .tippy-box[data-theme~='custom'] .dropdown-menu-separator::after { content: ''; flex: 1; border-bottom: 1px solid hsl(var(--border)); } .tippy-box[data-theme~='custom'] .dropdown-menu-separator::before { margin-right: 0.5em; } .tippy-box[data-theme~='custom'] .dropdown-menu-separator::after { margin-left: 0.5em; } .tippy-box[data-theme~='custom'] .dropdown-menu-separator-text { padding: 0 10px; font-size: 0.85em; color: hsl(var(--muted-foreground)); white-space: nowrap; } .tippy-box[data-theme~='custom'] .dropdown-menu-item.danger { color: hsl(var(--destructive-foreground)); } .tippy-box[data-theme~='custom'] .dropdown-menu-item.danger:hover { background-color: hsl(var(--destructive)); } .tippy-box[data-theme~='custom'] .dropdown-menu-item.danger svg { color: var(--destructive-foreground); } @keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } } `; // Set the styles styleElement.textContent = styles; // Cleanup function return () => { }; }, []); return ( {children} ); }; ================================================ FILE: src/app/(app)/components/hero.tsx ================================================ import chromeSvg from '@assets/chrome.svg'; import Image from "next/image"; const Hero = () => { return ( <>

X Cards {' '} Native Tweet Card service for X

Capture and share posts as beautiful images, cards, Markdown, or JSON, making sharing Twitter posts on other platforms more visual and attention-grabbing. {' '}

{/* */}
) } export default Hero ================================================ FILE: src/app/(app)/components/save-as-template-button.tsx ================================================ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@components/ui/alert-dialog"; import { Button } from "@components/ui/button"; import { Input } from "@components/ui/input"; import { useCardStore } from "@src/hooks/useCardStore"; import { useTemplatesStore } from "@src/hooks/useTemplatesStore"; import React from "react"; export const SaveAsTemplateButton = () => { const cardStyles = useCardStore((state) => state.cardStyles); const addTemplate = useTemplatesStore((state) => state.addTemplate); const backgroundStyles = useCardStore((state) => state.backgroundStyles); const [name, setName] = React.useState(''); return ( Input Template Name {/* This action cannot be undone. This will permanently delete your account and remove your data from our servers. */} { setName(e.target.value) }}> Cancel addTemplate({ name: name, colorIndex: useCardStore.getState().colorIndex, backgroundStyles: backgroundStyles, tabConfig: useCardStore.getState().tabConfig, cardStyles: cardStyles })}>Confirm ) } ================================================ FILE: src/app/(app)/components/sections/FeaturesGridSection.tsx ================================================ // import yellowWaveDown from "@/public/images/banner-wave.png"; // import Image from "next/image"; import { BookCopy, LayoutGrid, ListCollapse, Palette } from "lucide-react"; import { useId } from "react"; function FeaturesGridSection() { return ( <>

Features

We provide a variety of features to help you create beautiful images, cards, Markdown, or JSON from tweets, making sharing Twitter posts on other platforms more visual and attention-grabbing.

{grid.map((feature) => (
{feature?.icon}

{feature.title}

{feature.description}

))}
{/* */} ); } const grid = [ { icon: ( ), title: "Fast capture", // description: // "快速将任何帖子转换为卡片,只需要亲亲点击" description: "Capture and share posts as beautiful images, cards, Markdown, or JSON, making sharing Twitter posts on other platforms more visual and attention-grabbing." }, { icon: ( ), title: "Custom Styles", // description: // "多种卡片风格,自定义颜色,边距等等" description: "Multiple card styles, custom colors, margins, and more." }, { icon: ( ), title: "Combining multiple posts", // description: // "拼接多个tweet内容,生成长卡片", description: "Combine multiple tweet contents to generate long cards." }, { icon: ( ), title: "Dynamic management", // description: // "动态管理你的帖子,随时删除,添加", description: "Manage your posts dynamically, delete or add them at any time." }, ]; const Grid = ({ pattern, size, }: { pattern?: number[][]; size?: number; }) => { const p = pattern ?? [ [Math.floor(Math.random() * 4) + 7, Math.floor(Math.random() * 6) + 1], [Math.floor(Math.random() * 4) + 7, Math.floor(Math.random() * 6) + 1], [Math.floor(Math.random() * 4) + 7, Math.floor(Math.random() * 6) + 1], [Math.floor(Math.random() * 4) + 7, Math.floor(Math.random() * 6) + 1], [Math.floor(Math.random() * 4) + 7, Math.floor(Math.random() * 6) + 1], ]; return (
); }; function GridPattern({ width, height, x, y, squares, ...props }: any) { const patternId = useId(); return ( ); } export default FeaturesGridSection; ================================================ FILE: src/app/(app)/components/sections/features2.tsx ================================================ // import { Icon } from "@/components/ui/icon"; import { Card, CardContent, CardHeader, CardTitle } from "@src/components/ui/card"; import { Icon } from "@src/components/ui/icon"; import { icons } from "lucide-react"; interface FeaturesProps { icon: string; title: string; description: string; } const featureList: FeaturesProps[] = [ { icon: "Globe", title: "Seamless Integration", description: "Integrate directly on x.com without any hassle. Our product works smoothly within the platform you're already using.", }, { icon: "MousePointerClick", title: "One-Click Generation", description: "Simple and easy to use. Generate and copy cards with just a single click, streamlining your workflow.", }, { icon: "Palette", title: "Customizable Design", description: "Personalize your cards by modifying styles, background colors, and more to match your brand or preferences.", }, { icon: "Eye", title: "Real-Time Preview", description: "See your changes instantly and manage your tweets dynamically, ensuring your content looks perfect before posting.", }, { icon: "FileText", title: "Long-Form Support", description: "Create and manage longer posts effortlessly, perfect for in-depth content or thread creation.", }, { icon: "Lock", title: "Open Source & Secure", description: "Our product is open source, ensuring transparency and allowing for community contributions while maintaining high security standards.", }, ]; export const FeaturesSection = () => { return (

Features

Why Choose Our Twitter Card Generator

Elevate your Twitter presence with our seamless, customizable, and secure card generator. Create eye-catching content directly on x.com with just a few clicks.

{featureList.map(({ icon, title, description }) => (
{title}
{description}
))}
); }; ================================================ FILE: src/app/(app)/components/sections/footer.tsx ================================================ import Link from "next/link"; import Logo from "@assets/icon.png"; export const FooterSection = () => { return (
{/* */} xcards

X Cards

Contact

Github
Twitter

Socials

Discord
{/* */}

© 2024 Designed and developed by Zane Ryan

); }; ================================================ FILE: src/app/(app)/components/sections/video.tsx ================================================ "use client" import ReactPlayer from 'react-player' const VideoSection = () => { return (
) } export default VideoSection ================================================ FILE: src/app/(app)/components/template-list.tsx ================================================ import { Button } from "@components/ui/button"; import { useCardStore } from "@src/hooks/useCardStore"; import { useTemplatesStore } from "@src/hooks/useTemplatesStore"; import { X } from "lucide-react"; export const TemplateList = () => { const templates = useTemplatesStore(state => state.templates); const delTemplate = useTemplatesStore(state => state.delTemplate); const setFontStyles = useCardStore(state => state.setFontStyles); const setColorIndex = useCardStore(state => state.setColorIndex); const updateBackgroundStyles = useCardStore(state => state.updateBackgroundStyles); const updateCardStyles = useCardStore(state => state.updateCardStyles); return (
{templates.map((t, index) => { return ( ) })}
) } ================================================ FILE: src/app/(app)/components/x-form.tsx ================================================ import { Button } from "@components/ui/button"; import { Input } from "@components/ui/input"; import { useCardStore, type XConfig } from "@src/hooks/useCardStore"; import { useState } from "react"; interface XFormProps { } export const XForm = (props: XFormProps) => { const [url, setUrl] = useState(''); const setXconfig = useCardStore(state => state.setXConfig); const handleGetX = async (url: string) => { const res = await fetch(`/api/x?url=${url}`, { method: 'GET', }) const data = await res.json(); console.log('res', res); setXconfig({ ...data.data, images: [data.data.imageUrl] } as XConfig) } return (
{ setUrl(e.target.value); }} value={url} type="url" placeholder="input X url" />
) } ================================================ FILE: src/app/(app)/layout.tsx ================================================ // "use client" import Image from 'next/image'; import Logo from '@assets/icon.png'; const AppLayout = ({ children }) => { return (

{" "} X cards also support the chrome extension version.{" "} Get Chrome Extension →

{children}
) } export default AppLayout; ================================================ FILE: src/app/(app)/page.tsx ================================================ import * as _ from 'lodash-es'; import Hero from "./components/hero"; import { cn } from "@lib/utils"; import gradientBottomSvg from '@assets/gradient-bottom.svg'; import { FooterSection } from './components/sections/footer'; import FeaturesGridSection from './components/sections/FeaturesGridSection'; const HomePage = () => { return ( <>
{/* */} {/* */} {/* */} {/* */} {/* */} ); }; export default HomePage; ================================================ FILE: src/app/(app)/request.tsx ================================================ ================================================ FILE: src/app/(extension)/independent/components/index.tsx ================================================ "use client" import { useEffect, useRef } from "react"; import { useCardStore, type XConfig } from "@src/hooks/useCardStore"; import { CardGenerator } from "../../../(app)/components/card-generator"; import * as _ from "lodash-es" import { generateImage } from "@src/app/utils/image"; import type { CardConfig } from "@src/components/extension/use-tweet-collection"; export async function generateStaticParams() { return [{ slug: 'independent' }] } const Index = () => { useEffect(() => { const fn = async (event) => { // if (event.origin !== 'https://x-cards.net') return; const actionName = 'generate-card-local' if (event.data.action === actionName) { console.log('收到消息来自', event.data, event.origin); const body = event.data.body as { tweetInfo: XConfig[], cardConfig: CardConfig, } const { tweetInfo, cardConfig } = body; useCardStore.getState().setXConfig(tweetInfo) if (cardConfig?.colorIndex) { useCardStore.getState().setColorIndex(cardConfig.colorIndex); } if (cardConfig.padding >= 0) { useCardStore.getState().updateBackgroundStyles({ padding: cardConfig.padding }); } if (cardConfig.fontSize ) { useCardStore.getState().updateCardStyles({ fontSize: cardConfig.fontSize, fontFamily: cardConfig.fontFamily || 'Inter' }); } // if (cardConfig.fontFamily) { // loadFont(cardConfig.fontFamily); // } if (cardConfig?.controls) { useCardStore.getState().updateCardStyles({ controls: cardConfig.controls }); } if (cardConfig?.width) { useCardStore.getState().updateCardStyles({ width: cardConfig.width, // height: cardConfig.height }); } // const loadedImages = useCardStore.getState().loadedImages; // const images = _.flatten(tweetInfo.map((tweet) => tweet.images)); // let allImagesLoaded = _.every(images, (src) => loadedImages[src] === 'success' || loadedImages[src] === 'error'); // // console.log('本次等待加载的图片', images); // while (!allImagesLoaded) { // // console.log('等待图片加载完成', loadedImages); // allImagesLoaded = _.every(images, (src) => loadedImages[src] === 'success' || loadedImages[src] === 'error'); // await new Promise((resolve) => setTimeout(resolve, 1000)); // } requestAnimationFrame(async () => { const dataUrl = await generateImage({ data: tweetInfo, format: cardConfig?.format || 'png', scale: cardConfig?.scale || 2, fontFamily: cardConfig.fontFamily || false, }); if (event.source && event.source.postMessage) { event.source.postMessage({ action: 'generate-card-local', value: { dataUrl: dataUrl } }, event.origin); } }); } } if (typeof window !== 'undefined') { window.addEventListener('message', fn); return () => { window.removeEventListener('message', fn); } } }, []) return ( ); } export default Index; ================================================ FILE: src/app/(extension)/independent/page.tsx ================================================ // import Index from "./components"; export async function generateStaticParams() { return [{ slug: 'independent' }] } import dynamic from 'next/dynamic' const Index = dynamic(() => import('./components'), { ssr: false, }); const Page = () => { return (
); } export default Page; ================================================ FILE: src/app/(extension)/welcome/page.tsx ================================================ import { cn } from "@lib/utils" import gradientBottomSvg from '@assets/gradient-bottom.svg'; import introPng from '@assets/install_guide/intro.png'; import Image from 'next/image'; import XCardLogo from '@assets/icon.png'; import VideoSection from "@src/app/(app)/components/sections/video"; const WelcomePage = () => { return (
) } export default WelcomePage; ================================================ FILE: src/app/api/license/route.ts ================================================ import { NextResponse, type NextRequest } from "next/server"; import { createClient } from '@supabase/supabase-js' export const POST = async (req: NextRequest) => { const { purchaseCode } = await req.json(); // 确保 purchaseCode 不为空 if (!purchaseCode) { return NextResponse.json({ message: 'Purchase code is required' }, { status: 400 }); } const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.SUPABASE_SERVICE_KEY! ); try { // 查询注册码 const { data, error } = await supabase .from('licenses') .select('*') .eq('code', purchaseCode) .single(); if (error) { console.error('Error querying database:', error); return NextResponse.json({ message: 'Internal server error' }, { status: 500 }); } if (!data) { return NextResponse.json({ message: 'Invalid purchase code' }, { status: 400 }); } // 检查是否已被使用 // if (data.is_used === 1) { // return NextResponse.json({ message: 'Purchase code has already been used' }, { status: 400 }); // } // 标记为已使用 const { error: updateError } = await supabase .from('licenses') .update({ is_used: data.is_used + 1 }) .eq('id', data.id); if (updateError) { console.error('Error updating license:', updateError); return NextResponse.json({ message: 'Error activating license' }, { status: 500 }); } return NextResponse.json({ message: 'License activated', }); } catch (error) { console.error('Error checking purchase code:', error); return NextResponse.json({ message: 'Internal server error' }, { status: 500 }); } }; ================================================ FILE: src/app/api/x/route.ts ================================================ // import type { NextApiRequest } from "next"; // import { NextResponse, type NextRequest } from "next/server"; // // export const dynamic = 'dynamic'; // export const GET = async (req: NextApiRequest) => { // // const url = req.searchParams.get('url'); // const url = req.url; // const regex = /[?&]url=([^&#]*)/; // const match = url.match(regex); // const extractedUrl = match ? decodeURIComponent(match[1]) : null; // const res = await fetch(`https://cmt.itsvg.in/api?url=${extractedUrl}`, { // method: 'GET', // }) // const data = await res.json(); // console.log('res', data); // return NextResponse.json({ // status: 200, // data, // }); // } ================================================ FILE: src/app/globals.css ================================================ @tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { --background: 0 0% 100%; --foreground: 20 14.3% 4.1%; --card: 0 0% 100%; --card-foreground: 20 14.3% 4.1%; --popover: 0 0% 100%; --popover-foreground: 20 14.3% 4.1%; --primary: 47.9 95.8% 53.1%; --primary-foreground: 26 83.3% 14.1%; --secondary: 60 4.8% 95.9%; --secondary-foreground: 24 9.8% 10%; --muted: 60 4.8% 95.9%; --muted-foreground: 25 5.3% 44.7%; --accent: 60 4.8% 95.9%; --accent-foreground: 24 9.8% 10%; --destructive: 0 84.2% 60.2%; --destructive-foreground: 60 9.1% 97.8%; --border: 20 5.9% 90%; --input: 20 5.9% 90%; --ring: 20 14.3% 4.1%; --radius: 0.5rem; --chart-1: 12 76% 61%; --chart-2: 173 58% 39%; --chart-3: 197 37% 24%; --chart-4: 43 74% 66%; --chart-5: 27 87% 67%; } .dark { --background: 20 14.3% 4.1%; --foreground: 60 9.1% 97.8%; --card: 20 14.3% 4.1%; --card-foreground: 60 9.1% 97.8%; --popover: 20 14.3% 4.1%; --popover-foreground: 60 9.1% 97.8%; --primary: 47.9 95.8% 53.1%; --primary-foreground: 26 83.3% 14.1%; --secondary: 12 6.5% 15.1%; --secondary-foreground: 60 9.1% 97.8%; --muted: 12 6.5% 15.1%; --muted-foreground: 24 5.4% 63.9%; --accent: 12 6.5% 15.1%; --accent-foreground: 60 9.1% 97.8%; --destructive: 0 62.8% 30.6%; --destructive-foreground: 60 9.1% 97.8%; --border: 12 6.5% 15.1%; --input: 12 6.5% 15.1%; --ring: 35.5 91.7% 32.9%; --chart-1: 220 70% 50%; --chart-2: 160 60% 45%; --chart-3: 30 80% 55%; --chart-4: 280 65% 60%; --chart-5: 340 75% 55%; } } /* #card { font-family: ui-sans-serif, system-ui, -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; } */ .sidebar-active { --tw-bg-opacity: 0.2; /* background-color: rgba(243, 244, 246, var(--tw-bg-opacity)); bg-gray-100 */ background-color: rgba(156, 163, 175, var(--tw-bg-opacity)); /* bg-gray-400 */ --tw-text-opacity: 1; color: rgba(11, 166, 101, var(--tw-text-opacity)); /* text-indigo-500 */ } .no-scrollbar::-webkit-scrollbar { display: none; } .no-scrollbar { -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ } ================================================ FILE: src/app/layout.tsx ================================================ import { Toaster } from "@/components/ui/sonner" import Logo from '@assets/icon.png' import './globals.css' import { siteConfig } from "@src/config/site"; export const metadata = { title: siteConfig.name, description: siteConfig.description, keywords: siteConfig.keywords, authors: siteConfig.authors, creator: siteConfig.creator, themeColor: siteConfig.themeColor, icons: siteConfig.icons, // metadataBase: siteConfig.metadataBase, openGraph: siteConfig.openGraph, twitter: siteConfig.twitter, }; export default function RootLayout({ children, }: { children: React.ReactNode }) { const getClarityAnalyticsTag = () => { return { __html: ` (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "nn68ny4psp");`, } } const getGoogleAnalyticsTag = () => { return { __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-18KTPX8NV1'); `, } } return (