| @@ -1,20 +1,23 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace SimpleAnalytics\UI; |
| 4 | 4 | |
| 5 | -use SimpleAnalytics\Settings\{Page, Tab}; | |
| 5 | +use SimpleAnalytics\Settings\{AdminPage, Tab}; | |
| 6 | 6 | use function SimpleAnalytics\get_icon; |
| 7 | 7 | use const SimpleAnalytics\PLUGIN_URL; |
| 8 | 8 | |
| 9 | 9 | class PageLayoutComponent |
| 10 | 10 | { |
| 11 | + private const DASHBOARD_URL = 'https://dashboard.simpleanalytics.com/?utm_source=wordpress&utm_medium=plugin&utm_content=go_to_dashboard_button'; | |
| 12 | + private const SIGNUP_URL = 'https://www.simpleanalytics.com/signup?utm_source=wordpress&utm_medium=plugin&utm_content=signup_link'; | |
| 13 | + | |
| 11 | 14 | /** |
| 12 | 15 | * @readonly |
| 13 | - * @var \SimpleAnalytics\Settings\Page | |
| 16 | + * @var \SimpleAnalytics\Settings\AdminPage | |
| 14 | 17 | */ |
| 15 | 18 | private $page; |
| 16 | - public function __construct(Page $page) | |
| 19 | + public function __construct(AdminPage $page) | |
| 17 | 20 | { |
| 18 | 21 | $this->page = $page; |
| 19 | 22 | } |
| 20 | 23 | |
| @@ -43,9 +46,9 @@ | ||
| 43 | 46 | <div class="mx-auto max-w-3xl flex-col justify-between gap-5 sm:flex sm:items-baseline"> |
| 44 | 47 | <div class="flex items-center"> |
| 45 | 48 | <!-- Logo --> |
| 46 | 49 | <a |
| 47 | - href="https://dashboard.simpleanalytics.com/websites" | |
| 50 | + href="<?php echo esc_url(self::DASHBOARD_URL); ?>" | |
| 48 | 51 | target="_blank" |
| 49 | 52 | class="text-base font-semibold leading-6 text-gray-900" |
| 50 | 53 | > |
| 51 | 54 | <img |
| @@ -55,9 +58,9 @@ | ||
| 55 | 58 | > |
| 56 | 59 | </a> |
| 57 | 60 | <!-- "Open Dashboard" link --> |
| 58 | 61 | <a |
| 59 | - href="https://dashboard.simpleanalytics.com/websites" | |
| 62 | + href="<?php echo esc_url(self::DASHBOARD_URL); ?>" | |
| 60 | 63 | target="_blank" |
| 61 | 64 | class="inline-flex items-center rounded bg-white px-2 py-1 text-xs font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50" |
| 62 | 65 | > |
| 63 | 66 | <?php echo get_icon('external')->class('w-3.5 h-3.5 mr-0.5'); ?> |
| @@ -74,19 +77,24 @@ | ||
| 74 | 77 | |
| 75 | 78 | <!-- Fields / Layout --> |
| 76 | 79 | <div class="mx-auto max-w-3xl bg-white px-4 py-6 sm:px-4 lg:px-0"> |
| 77 | 80 | <div class="border-b border-gray-900/10 pb-7"> |
| 81 | + <?php if ($currentTab->getSlug() === 'general'): ?> | |
| 82 | + <?php $this->renderGeneralTabIntro(); ?> | |
| 83 | + <?php endif; ?> | |
| 78 | 84 | <?php $currentTab->render(); ?> |
| 79 | 85 | </div> |
| 80 | 86 | |
| 81 | - <div class="mt-6 flex items-center justify-start gap-x-6"> | |
| 82 | - <button | |
| 83 | - type="submit" | |
| 84 | - class="rounded-md px-3 py-2 text-sm font-semibold text-white shadow-sm bg-primary hover:bg-red-500 focus-visible:outline-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2" | |
| 85 | - > | |
| 86 | - Save Changes | |
| 87 | - </button> | |
| 88 | - </div> | |
| 87 | + <?php if ($currentTab->getSlug() !== 'general'): ?> | |
| 88 | + <div class="mt-6 flex items-center justify-start gap-x-6"> | |
| 89 | + <button | |
| 90 | + type="submit" | |
| 91 | + class="rounded-md px-3 py-2 text-sm font-semibold text-white shadow-sm bg-primary hover:bg-red-500 focus-visible:outline-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2" | |
| 92 | + > | |
| 93 | + Save Changes | |
| 94 | + </button> | |
| 95 | + </div> | |
| 96 | + <?php endif; ?> | |
| 89 | 97 | </div> |
| 90 | 98 | </form> |
| 91 | 99 | <script> |
| 92 | 100 | /** |
| @@ -138,6 +146,50 @@ | ||
| 138 | 146 | if ($tab->getSlug() === $slug) return $tab; |
| 139 | 147 | } |
| 140 | 148 | |
| 141 | 149 | return null; |
| 150 | + } | |
| 151 | + | |
| 152 | + protected function renderGeneralTabIntro(): void | |
| 153 | + { | |
| 154 | + ?> | |
| 155 | + <div class="mb-7" style="max-width: 64ch;"> | |
| 156 | + <p class="text-sm text-gray-700"> | |
| 157 | + Simple Analytics is now added to your WordPress site. | |
| 158 | + </p> | |
| 159 | + <p class="mt-4 text-sm text-gray-700"> | |
| 160 | + The plugin collects pageviews in a privacy-first way, without cookies or personal data. | |
| 161 | + </p> | |
| 162 | + <p class="mt-4 text-sm text-gray-700"> | |
| 163 | + Your stats will appear in | |
| 164 | + <a class="text-primary hover:underline" target="_blank" href="<?php echo esc_url(self::DASHBOARD_URL); ?>"> | |
| 165 | + the Simple Analytics dashboard | |
| 166 | + </a> | |
| 167 | + within a few minutes. | |
| 168 | + </p> | |
| 169 | + <p class="mt-4 text-sm text-gray-700"> | |
| 170 | + To avoid tracking your own visits, go to the "Ignore Rules" tab and ignore visits from logged-in admins. | |
| 171 | + You can also add your own IP address there. | |
| 172 | + </p> | |
| 173 | + <p class="mt-4 text-sm text-gray-700"> | |
| 174 | + To automatically track downloads, outbound links, and email clicks, go to the "Events" tab and enable "Collect automated events". | |
| 175 | + </p> | |
| 176 | + <p class="mt-4 text-sm text-gray-700"> | |
| 177 | + No account yet? Create one at | |
| 178 | + <a class="text-primary hover:underline" target="_blank" href="<?php echo esc_url(self::SIGNUP_URL); ?>"> | |
| 179 | + simpleanalytics.com. | |
| 180 | + </a> | |
| 181 | + You can start with a free trial and choose a free or paid plan later. | |
| 182 | + </p> | |
| 183 | + <p class="mt-6"> | |
| 184 | + <a | |
| 185 | + href="<?php echo esc_url(self::DASHBOARD_URL); ?>" | |
| 186 | + target="_blank" | |
| 187 | + class="inline-flex items-center rounded bg-primary px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500" | |
| 188 | + > | |
| 189 | + Open dashboard | |
| 190 | + </a> | |
| 191 | + </p> | |
| 192 | + </div> | |
| 193 | + <?php | |
| 142 | 194 | } |
| 143 | 195 | } |