PluginProbe ʕ •ᴥ•ʔ
Presto Player / trunk
Presto Player vtrunk
4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / src / admin / dashboard / pages / settings / PerformancePage.js
presto-player / src / admin / dashboard / pages / settings Last commit date
general 1 month ago integrations 1 month ago shared 1 month ago PerformancePage.js 1 month ago config.js 1 month ago entities.js 1 month ago
PerformancePage.js
111 lines
1 import { __ } from '@wordpress/i18n';
2 import { useEffect, useState } from 'react';
3 import { Container, Switch, Alert, Tooltip } from '@bsf/force-ui';
4 import { Info } from 'lucide-react';
5 import SettingsPageShell from './shared/SettingsPageShell';
6 import SectionCard from './shared/SectionCard';
7 import useSimpleSettingsPage from '../../hooks/useSimpleSettingsPage';
8 import { OPTION_KEYS } from './config';
9
10 const DEFAULTS = {
11 module_enabled: false,
12 automations: true,
13 };
14
15 const PerformancePage = ( { registerActivePage } ) => {
16 const { data, update, handleSave, isDirty, isSaving, isLoading } =
17 useSimpleSettingsPage(
18 OPTION_KEYS.performance,
19 DEFAULTS,
20 registerActivePage
21 );
22
23 const [ noteDismissed, setNoteDismissed ] = useState( false );
24
25 // Reset dismissal when the feature is turned off so the note reappears
26 // next time the user enables it — they may have forgotten the caveats.
27 useEffect( () => {
28 if ( ! data.module_enabled ) {
29 setNoteDismissed( false );
30 }
31 }, [ data.module_enabled ] );
32
33 return (
34 <SettingsPageShell
35 title={ __( 'Performance', 'presto-player' ) }
36 isDirty={ isDirty }
37 isSaving={ isSaving }
38 isLoading={ isLoading }
39 onSave={ handleSave }
40 >
41 <SectionCard>
42 <Container direction="column" className="gap-4">
43 <Switch
44 size="md"
45 value={ !! data.module_enabled }
46 onChange={ ( val ) => update( { module_enabled: val } ) }
47 label={ {
48 heading: __( 'Dynamically Load JavaScript', 'presto-player' ),
49 description: __(
50 'Dynamically load javascript modules on the page which can significantly reduce javascript size and increase performance.',
51 'presto-player'
52 ),
53 } }
54 />
55
56 { !! data.module_enabled && ! noteDismissed && (
57 <Alert
58 design="stack"
59 variant="info"
60 title={ __( 'Please Note', 'presto-player' ) }
61 content={
62 <>
63 { __(
64 'You may need to exclude the player script from combining, as well as enable CORS requests for some CDNs.',
65 'presto-player'
66 ) }{ ' ' }
67 <a
68 href="https://prestoplayer.com/docs/performance-preferences-explained#global-player-performance-setting"
69 target="_blank"
70 rel="noreferrer"
71 className="text-brand-primary-600 hover:underline"
72 >
73 { __( 'Learn More', 'presto-player' ) }
74 </a>
75 </>
76 }
77 onClose={ () => setNoteDismissed( true ) }
78 />
79 ) }
80
81 <Switch
82 size="md"
83 value={ !! data.automations }
84 onChange={ ( val ) => update( { automations: val } ) }
85 label={ {
86 heading: (
87 <span className="inline-flex items-center gap-1.5">
88 { __( 'Enable Ajax Requests for Progress Integrations', 'presto-player' ) }
89 <Tooltip
90 content={ __( 'Required for LMS, membership, and automation integrations to track video progress correctly. Disable only if you are not using any such integrations.', 'presto-player' ) }
91 arrow
92 placement="right"
93 >
94 <Info className="size-3.5 text-icon-secondary cursor-help shrink-0" />
95 </Tooltip>
96 </span>
97 ),
98 description: __(
99 'Keep this on unless you do not plan on using automation, LMS or membership integrations.',
100 'presto-player'
101 ),
102 } }
103 />
104 </Container>
105 </SectionCard>
106 </SettingsPageShell>
107 );
108 };
109
110 export default PerformancePage;
111