diff --git a/.env.production b/.env.production index e403f96b6..d25eb7dd4 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -NEXT_PUBLIC_GA_TRACKING_ID = 'G-B1E83PJ3RT' \ No newline at end of file +NEXT_PUBLIC_GA_TRACKING_ID = 'UA-41298772-4' \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/0-bug.yml b/.github/ISSUE_TEMPLATE/0-bug.yml deleted file mode 100644 index 56d2e8540..000000000 --- a/.github/ISSUE_TEMPLATE/0-bug.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "🐛 Report a bug" -description: "Report a problem on the website." -title: "[Bug]: " -labels: ["bug: unconfirmed"] -body: - - type: textarea - attributes: - label: Summary - description: | - A clear and concise summary of what the bug is. - placeholder: | - Example bug report: - When I click the "Submit" button on "Feedback", nothing happens. - validations: - required: true - - type: input - attributes: - label: Page - description: | - What page(s) did you encounter this bug on? - placeholder: | - https://react.dev/ - validations: - required: true - - type: textarea - attributes: - label: Details - description: | - Please provide any additional details about the bug. - placeholder: | - Example details: - The "Submit" button is unresponsive. I've tried refreshing the page and using a different browser, but the issue persists. - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/1-typo.yml b/.github/ISSUE_TEMPLATE/1-typo.yml deleted file mode 100644 index c86557a11..000000000 --- a/.github/ISSUE_TEMPLATE/1-typo.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "🤦 Typo or mistake" -description: "Report a typo or mistake in the docs." -title: "[Typo]: " -labels: ["type: typos"] -body: - - type: textarea - attributes: - label: Summary - description: | - A clear and concise summary of what the mistake is. - placeholder: | - Example: - The code example on the "useReducer" page includes an unused variable `nextId`. - validations: - required: true - - type: input - attributes: - label: Page - description: | - What page is the typo on? - placeholder: | - https://react.dev/ - validations: - required: true - - type: textarea - attributes: - label: Details - description: | - Please provide a explanation for why this is a mistake. - placeholder: | - Example mistake: - In the "useReducer" section of the "API Reference" page, the code example under "Writing a reducer function" includes an unused variable `nextId` that should be removed. - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/2-suggestion.yml b/.github/ISSUE_TEMPLATE/2-suggestion.yml deleted file mode 100644 index ac0b480fe..000000000 --- a/.github/ISSUE_TEMPLATE/2-suggestion.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "💡 Suggestions" -description: "Suggest a new page, section, or edit for an existing page." -title: "[Suggestion]: " -labels: ["type: documentation"] -body: - - type: textarea - attributes: - label: Summary - description: | - A clear and concise summary of what we should add. - placeholder: | - Example: - Add a new page for how to use React with TypeScript. - validations: - required: true - - type: input - attributes: - label: Page - description: | - What page is this about? - placeholder: | - https://react.dev/ - validations: - required: false - - type: textarea - attributes: - label: Details - description: | - Please provide a explanation for what you're suggesting. - placeholder: | - Example: - I think it would be helpful to have a page that explains how to use React with TypeScript. This could include a basic example of a component written in TypeScript, and a link to the TypeScript documentation. - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/3-framework.yml b/.github/ISSUE_TEMPLATE/3-framework.yml deleted file mode 100644 index a47295e1e..000000000 --- a/.github/ISSUE_TEMPLATE/3-framework.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: "📄 Suggest new framework" -description: "I am a framework author applying to be included as a recommended framework." -title: "[Framework]: " -labels: ["type: framework"] -body: - - type: markdown - attributes: - value: | - ## Apply to be included as a recommended React framework - - _This form is for framework authors to apply to be included as a recommended [React framework](https://react.dev/learn/start-a-new-react-project). If you are not a framework author, please contact the authors before submitting._ - - Our goal when recommending a framework is to start developers with a React project that solves common problems like code splitting, data fetching, routing, and HTML generation without any extra work later. We believe this will allow users to get started quickly with React, and scale their app to production. - - While we understand that many frameworks may want to be featured, this page is not a place to advertise every possible React framework or all frameworks that you can add React to. There are many great frameworks that offer support for React that are not listed in our guides. The frameworks we recommend have invested significantly in the React ecosystem, and collaborated with the React team to be compatible with our [full-stack React architecture vision](https://react.dev/learn/start-a-new-react-project#which-features-make-up-the-react-teams-full-stack-architecture-vision). - - To be included, frameworks must meet the following criteria: - - - **Free & open-source**: must be open source and free to use. - - **Well maintained**. must be actively maintained, providing bug fixes and improvements. - - **Active community**: must have a sufficiently large and active community to support users. - - **Clear onboarding**: must have clear install steps to install the React version of the framework. - - **Ecosystem compatibility**: must support using the full range of libraries and tools in the React ecosystem. - - **Self-hosting option**: must support an option to self-host applications without losing access to features. - - **Developer experience**. must allow developers to be productive by supporting features like Fast Refresh. - - **User experience**. must provide built-in support for common problems like routing and data-fetching. - - **Compatible with our future vision for React**. React evolves over time, and frameworks that do not align with React’s direction risk isolating their users from the main React ecosystem over time. To be included on this page we must feel confident that the framework is setting its users up for success with React over time. - - Please note, we have reviewed most of the popular frameworks available today, so it is unlikely we have not considered your framework already. But if you think we missed something, please complete the application below. - - type: input - attributes: - label: Name - description: | - What is the name of your framework? - validations: - required: true - - type: input - attributes: - label: Homepage - description: | - What is the URL of your homepage? - validations: - required: true - - type: input - attributes: - label: Install instructions - description: | - What is the URL of your getting started guide? - validations: - required: true - - type: dropdown - attributes: - label: Is your framework open source? - description: | - We only recommend free and open source frameworks. - options: - - 'No' - - 'Yes' - validations: - required: true - - type: textarea - attributes: - label: Well maintained - description: | - Please describe how your framework is actively maintained. Include recent releases, bug fixes, and improvements as examples. - validations: - required: true - - type: textarea - attributes: - label: Active community - description: | - Please describe your community. Include the size of your community, and links to community resources. - validations: - required: true - - type: textarea - attributes: - label: Clear onboarding - description: | - Please describe how a user can install your framework with React. Include links to any relevant documentation. - validations: - required: true - - type: textarea - attributes: - label: Ecosystem compatibility - description: | - Please describe any limitations your framework has with the React ecosystem. Include any libraries or tools that are not compatible with your framework. - validations: - required: true - - type: textarea - attributes: - label: Self-hosting option - description: | - Please describe how your framework supports self-hosting. Include any limitations to features when self-hosting. Also include whether you require a server to deploy your framework. - validations: - required: true - - type: textarea - attributes: - label: Developer Experience - description: | - Please describe how your framework provides a great developer experience. Include any limitations to React features like React DevTools, Chrome DevTools, and Fast Refresh. - validations: - required: true - - type: textarea - attributes: - label: User Experience - description: | - Please describe how your framework helps developers create high quality user experiences by solving common use-cases. Include specifics for how your framework offers built-in support for code-splitting, routing, HTML generation, and data-fetching in a way that avoids client/server waterfalls by default. Include details on how you offer features such as SSG and SSR. - validations: - required: true - - type: textarea - attributes: - label: Compatible with our future vision for React - description: | - Please describe how your framework aligns with our future vision for React. Include how your framework will evolve with React over time, and your plans to support future React features like React Server Components. - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 63e310e0b..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -contact_links: - - name: 📃 Bugs in React - url: https://github.com/facebook/react/issues/new/choose - about: This issue tracker is not for bugs in React. Please file React issues here. - - name: 🤔 Questions and Help - url: https://reactjs.org/community/support.html - about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums. diff --git a/package.json b/package.json index 274c2506e..fd96f064b 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "classnames": "^2.2.6", "date-fns": "^2.16.1", "debounce": "^1.2.1", + "ga-lite": "^2.1.4", "github-slugger": "^1.3.0", "next": "^13.4.1", "next-remote-watch": "^1.0.0", @@ -91,7 +92,7 @@ "retext": "^7.0.1", "retext-smartypants": "^4.0.0", "rss": "^1.2.2", - "tailwindcss": "^3.4.1", + "tailwindcss": "^3.3.2", "typescript": "^4.0.2", "unist-util-visit": "^2.0.3", "webpack-bundle-analyzer": "^4.5.0" diff --git a/plugins/remark-smartypants.js b/plugins/remark-smartypants.js index 4694ff674..7dd1b0c4a 100644 --- a/plugins/remark-smartypants.js +++ b/plugins/remark-smartypants.js @@ -1,8 +1,3 @@ -/*! - * Based on 'silvenon/remark-smartypants' - * https://github.com/silvenon/remark-smartypants/pull/80 - */ - const visit = require('unist-util-visit'); const retext = require('retext'); const smartypants = require('retext-smartypants'); @@ -14,48 +9,12 @@ function check(parent) { } module.exports = function (options) { - const processor = retext().use(smartypants, { - ...options, - // Do not replace ellipses, dashes, backticks because they change string - // length, and we couldn't guarantee right splice of text in second visit of - // tree - ellipses: false, - dashes: false, - backticks: false, - }); - - const processor2 = retext().use(smartypants, { - ...options, - // Do not replace quotes because they are already replaced in the first - // processor - quotes: false, - }); + const processor = retext().use(smartypants, options); function transformer(tree) { - let allText = ''; - let startIndex = 0; - const textOrInlineCodeNodes = []; - - visit(tree, ['text', 'inlineCode'], (node, _, parent) => { - if (check(parent)) { - if (node.type === 'text') allText += node.value; - // for the case when inlineCode contains just one part of quote: `foo'bar` - else allText += 'A'.repeat(node.value.length); - textOrInlineCodeNodes.push(node); - } + visit(tree, 'text', (node, index, parent) => { + if (check(parent)) node.value = String(processor.processSync(node.value)); }); - - // Concat all text into one string, to properly replace quotes around non-"text" nodes - allText = String(processor.processSync(allText)); - - for (const node of textOrInlineCodeNodes) { - const endIndex = startIndex + node.value.length; - if (node.type === 'text') { - const processedText = allText.slice(startIndex, endIndex); - node.value = String(processor2.processSync(processedText)); - } - startIndex = endIndex; - } } return transformer; diff --git a/public/images/docs/diagrams/conditional_render_tree.dark.png b/public/images/docs/diagrams/conditional_render_tree.dark.png deleted file mode 100644 index 5189a44c8..000000000 Binary files a/public/images/docs/diagrams/conditional_render_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/conditional_render_tree.png b/public/images/docs/diagrams/conditional_render_tree.png deleted file mode 100644 index c76e8cb63..000000000 Binary files a/public/images/docs/diagrams/conditional_render_tree.png and /dev/null differ diff --git a/public/images/docs/diagrams/generic_dependency_tree.dark.png b/public/images/docs/diagrams/generic_dependency_tree.dark.png deleted file mode 100644 index 64694f585..000000000 Binary files a/public/images/docs/diagrams/generic_dependency_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/generic_dependency_tree.png b/public/images/docs/diagrams/generic_dependency_tree.png deleted file mode 100644 index 8ab6f1a34..000000000 Binary files a/public/images/docs/diagrams/generic_dependency_tree.png and /dev/null differ diff --git a/public/images/docs/diagrams/generic_render_tree.dark.png b/public/images/docs/diagrams/generic_render_tree.dark.png deleted file mode 100644 index 859fdaa96..000000000 Binary files a/public/images/docs/diagrams/generic_render_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/generic_render_tree.png b/public/images/docs/diagrams/generic_render_tree.png deleted file mode 100644 index 952cf5faa..000000000 Binary files a/public/images/docs/diagrams/generic_render_tree.png and /dev/null differ diff --git a/public/images/docs/diagrams/module_dependency_tree.dark.png b/public/images/docs/diagrams/module_dependency_tree.dark.png deleted file mode 100644 index e8a85f7c0..000000000 Binary files a/public/images/docs/diagrams/module_dependency_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/module_dependency_tree.png b/public/images/docs/diagrams/module_dependency_tree.png deleted file mode 100644 index 0dcaaa7aa..000000000 Binary files a/public/images/docs/diagrams/module_dependency_tree.png and /dev/null differ diff --git a/public/images/docs/diagrams/render_tree.dark.png b/public/images/docs/diagrams/render_tree.dark.png deleted file mode 100644 index 117d7ff3e..000000000 Binary files a/public/images/docs/diagrams/render_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/render_tree.png b/public/images/docs/diagrams/render_tree.png deleted file mode 100644 index 1ea750bb0..000000000 Binary files a/public/images/docs/diagrams/render_tree.png and /dev/null differ diff --git a/public/images/docs/diagrams/use_client_module_dependency.dark.png b/public/images/docs/diagrams/use_client_module_dependency.dark.png deleted file mode 100644 index c50e7308b..000000000 Binary files a/public/images/docs/diagrams/use_client_module_dependency.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/use_client_module_dependency.png b/public/images/docs/diagrams/use_client_module_dependency.png deleted file mode 100644 index d535246f7..000000000 Binary files a/public/images/docs/diagrams/use_client_module_dependency.png and /dev/null differ diff --git a/public/images/docs/diagrams/use_client_render_tree.dark.png b/public/images/docs/diagrams/use_client_render_tree.dark.png deleted file mode 100644 index 8d3e6a484..000000000 Binary files a/public/images/docs/diagrams/use_client_render_tree.dark.png and /dev/null differ diff --git a/public/images/docs/diagrams/use_client_render_tree.png b/public/images/docs/diagrams/use_client_render_tree.png deleted file mode 100644 index ad3840681..000000000 Binary files a/public/images/docs/diagrams/use_client_render_tree.png and /dev/null differ diff --git a/public/images/team/noahlemen.jpg b/public/images/team/noahlemen.jpg deleted file mode 100644 index e3f788d89..000000000 Binary files a/public/images/team/noahlemen.jpg and /dev/null differ diff --git a/src/components/DocsFooter.tsx b/src/components/DocsFooter.tsx index c0833322d..a3ff2c951 100644 --- a/src/components/DocsFooter.tsx +++ b/src/components/DocsFooter.tsx @@ -27,7 +27,7 @@ export const DocsPageFooter = memo( <> {prevRoute?.path || nextRoute?.path ? ( <> -
+
{prevRoute?.path ? ( -
- + + {type === 'Previous' ? 'Wstecz' : 'Dalej'} - - {title} - -
+ {title} + ); } diff --git a/src/components/ErrorDecoderContext.tsx b/src/components/ErrorDecoderContext.tsx deleted file mode 100644 index 080969efe..000000000 --- a/src/components/ErrorDecoderContext.tsx +++ /dev/null @@ -1,23 +0,0 @@ -// Error Decoder requires reading pregenerated error message from getStaticProps, -// but MDX component doesn't support props. So we use React Context to populate -// the value without prop-drilling. -// TODO: Replace with React.cache + React.use when migrating to Next.js App Router - -import {createContext, useContext} from 'react'; - -const notInErrorDecoderContext = Symbol('not in error decoder context'); - -export const ErrorDecoderContext = createContext< - | {errorMessage: string | null; errorCode: string | null} - | typeof notInErrorDecoderContext ->(notInErrorDecoderContext); - -export const useErrorDecoderParams = () => { - const params = useContext(ErrorDecoderContext); - - if (params === notInErrorDecoderContext) { - throw new Error('useErrorDecoder must be used in error decoder pages only'); - } - - return params; -}; diff --git a/src/components/Icon/IconGitHub.tsx b/src/components/Icon/IconGitHub.tsx index 49d7fb460..de2a982bd 100644 --- a/src/components/Icon/IconGitHub.tsx +++ b/src/components/Icon/IconGitHub.tsx @@ -9,8 +9,8 @@ export const IconGitHub = memo( return ( diff --git a/src/components/Icon/IconThreads.tsx b/src/components/Icon/IconThreads.tsx deleted file mode 100644 index 5a007657f..000000000 --- a/src/components/Icon/IconThreads.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - */ - -import {memo} from 'react'; - -export const IconThreads = memo( - function IconThreads(props) { - return ( - - - - ); - } -); diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index d7f9fc152..7b24ba45f 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -4,7 +4,7 @@ import {useState} from 'react'; import {useRouter} from 'next/router'; -import cn from 'classnames'; +import {ga} from '../../utils/analytics'; export function Feedback({onSubmit = () => {}}: {onSubmit?: () => void}) { const {asPath} = useRouter(); @@ -46,33 +46,29 @@ const thumbsDownIcon = ( ); function sendGAEvent(isPositive: boolean) { - const category = isPositive ? 'like_button' : 'dislike_button'; - const value = isPositive ? 1 : 0; // Fragile. Don't change unless you've tested the network payload // and verified that the right events actually show up in GA. - // @ts-ignore - gtag('event', 'feedback', { - event_category: category, - event_label: window.location.pathname, - event_value: value, - }); + ga( + 'send', + 'event', + 'button', + 'feedback', + window.location.pathname, + isPositive ? '1' : '0' + ); } function SendFeedback({onSubmit}: {onSubmit: () => void}) { const [isSubmitted, setIsSubmitted] = useState(false); return ( -
-

+

+

{isSubmitted ? 'Dziękujemy za opinię!' : 'Czy ta strona była pomocna?'}

{!isSubmitted && ( -
+
@@ -260,16 +260,16 @@ export default function TopNav({
-
+
@@ -313,7 +313,7 @@ export default function TopNav({ onClick={() => { window.__setPreferredTheme('dark'); }} - className="flex items-center justify-center w-12 h-12 transition-transform rounded-full active:scale-95 hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> + className="active:scale-95 transition-transform flex w-12 h-12 rounded-full items-center justify-center hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> {darkIcon}
@@ -324,7 +324,7 @@ export default function TopNav({ onClick={() => { window.__setPreferredTheme('light'); }} - className="flex items-center justify-center w-12 h-12 transition-transform rounded-full active:scale-95 hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> + className="active:scale-95 transition-transform flex w-12 h-12 rounded-full items-center justify-center hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> {lightIcon}
@@ -334,7 +334,7 @@ export default function TopNav({ target="_blank" rel="noreferrer noopener" aria-label="Open on GitHub" - className="flex items-center justify-center w-12 h-12 transition-transform rounded-full active:scale-95 hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> + className="active:scale-95 transition-transform flex w-12 h-12 rounded-full items-center justify-center hover:bg-primary/5 hover:dark:bg-primary-dark/5 outline-link"> {githubIcon}
@@ -349,13 +349,13 @@ export default function TopNav({ className="overflow-y-scroll isolate no-bg-scrollbar lg:w-[342px] grow bg-wash dark:bg-wash-dark">