Performance.js
90 lines
| 1 | /** @jsx jsx */ |
| 2 | import { css, jsx } from "@emotion/core"; |
| 3 | |
| 4 | const { __ } = wp.i18n; |
| 5 | const { Notice, ExternalLink } = wp.components; |
| 6 | import { getSettings } from "@/admin/settings/util"; |
| 7 | |
| 8 | import ToggleControl from "../components/ToggleControl"; |
| 9 | |
| 10 | import Group from "../components/Group"; |
| 11 | import Page from "../components/Page"; |
| 12 | |
| 13 | export default () => { |
| 14 | const settings = getSettings(); |
| 15 | |
| 16 | return ( |
| 17 | <Page |
| 18 | title={__("Performance", "presto-player")} |
| 19 | description={__("Player performance preferences.", "presto-player")} |
| 20 | > |
| 21 | <Group |
| 22 | title={__("Performance", "presto-player")} |
| 23 | description={__( |
| 24 | "Performance options for player loading.", |
| 25 | "presto-player" |
| 26 | )} |
| 27 | > |
| 28 | <div> |
| 29 | <ToggleControl |
| 30 | className={"presto-player__setting--module-enabled"} |
| 31 | option={{ |
| 32 | id: "module_enabled", |
| 33 | name: __("Dynamically Load JavaScript", "presto-player"), |
| 34 | help: __( |
| 35 | "Dynamically load javascript modules on the page which can significantly reduce javascript size and increase performance.", |
| 36 | "presto-player" |
| 37 | ), |
| 38 | }} |
| 39 | value={settings?.presto_player_performance?.module_enabled} |
| 40 | optionName="performance" |
| 41 | /> |
| 42 | {!!settings?.presto_player_performance?.module_enabled && ( |
| 43 | <Notice |
| 44 | css={css` |
| 45 | background: #f3f4f5 !important; |
| 46 | `} |
| 47 | className="presto-notice" |
| 48 | status="info" |
| 49 | isDismissible={false} |
| 50 | > |
| 51 | <div> |
| 52 | <strong>{__("Please Note", "presto-player")}</strong> |
| 53 | </div> |
| 54 | <div> |
| 55 | {__( |
| 56 | "You may need to exclude the player script from combining, as well as enable CORS requests for some CDNs.", |
| 57 | "presto-player" |
| 58 | )}{" "} |
| 59 | <ExternalLink href="https://prestoplayer.com/docs/performance-preferences-explained#global-player-performance-setting"> |
| 60 | {__("Learn More", "presto-player")} |
| 61 | </ExternalLink> |
| 62 | </div> |
| 63 | </Notice> |
| 64 | )} |
| 65 | </div> |
| 66 | <ToggleControl |
| 67 | className={"presto-player__setting--module-enabled"} |
| 68 | option={{ |
| 69 | id: "automations", |
| 70 | name: __( |
| 71 | "Enable Ajax Requests for Progress Integrations", |
| 72 | "presto-player" |
| 73 | ), |
| 74 | help: __( |
| 75 | "Keep this on unless you do not plan on using automation, LMS or membership integrations.", |
| 76 | "presto-player" |
| 77 | ), |
| 78 | }} |
| 79 | value={ |
| 80 | settings?.presto_player_performance?.automations === undefined |
| 81 | ? true |
| 82 | : settings?.presto_player_performance?.automations |
| 83 | } |
| 84 | optionName="performance" |
| 85 | /> |
| 86 | </Group> |
| 87 | </Page> |
| 88 | ); |
| 89 | }; |
| 90 |