Commit Graph

529 Commits

Author SHA1 Message Date
Rishabh
2d43c12276 Fixed global variable leak for new card scripts
no issue

- wraps the card js scripts into an IIFE to avoid polluting global variables on the site
- also any fixes errors caused by `swup` and its scripts-plugin that trips over already created global variables
2021-12-08 22:58:22 +05:30
Fabien egg O'Carroll
55d7176e51 🐛 Fixed card scripts executing before DOM is parsed
no-issue

Using the async attribute means that the script is downloaded in
parallel with the parsing of the html into DOM, and then executed upon
completion. This means that the script cannot be sure that particular
parts of the DOM exist as it may not have finished parsing. This has
resulted in bugs with the new toggle card not working.

Switching our script to use the defer attribute means that the script is
still downloaded in parallel with parsing, but it is not executed until
parsing is complete. This means that the script can safely access the
DOM.
2021-12-08 17:54:37 +02:00
Daniel Lockyer
fa8c3ebe99 Revert "Extract logging from DI patterns, only use @tryghost/logging package"
This reverts commit 97451a93cb.
2021-12-08 14:28:41 +00:00
Sanne de Vries
6e4be46fb3 Updated audio card frontend styles in Chrome
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-08 12:22:39 +00:00
djordje vlaisavljevic
e72092fa5e Updated product card frontend styles
refs https://github.com/TryGhost/Team/issues/1245
2021-12-08 12:40:57 +01:00
Rishabh
9cbaab119b Refined audio card player with multiple playback rate options
refs https://github.com/TryGhost/Team/issues/1230

- adds multiple playback rate option to audio card player on click
2021-12-08 16:36:22 +05:30
djordje vlaisavljevic
cb86c06504 Removed unnecessary CSS and !important declarations
refs https://github.com/TryGhost/Team/issues/1245
2021-12-08 10:03:12 +01:00
djordje vlaisavljevic
88238e6403 Updated frontend styles for product card
refs https://github.com/TryGhost/Team/issues/1245
2021-12-07 20:58:42 +01:00
djordje vlaisavljevic
325de3e5cf Updated frontend styles for product card
refs https://github.com/TryGhost/Team/issues/1245
2021-12-07 20:16:45 +01:00
Rishabh
27ced6cc84 Refined audio card player sliders
refs https://github.com/TryGhost/Team/issues/1230

- refines seek and volume sliders for audio player to show progress marker with background color
2021-12-08 00:16:32 +05:30
djordje vlaisavljevic
bf78df0e07 Added frontend CSS file for product card
refs https://github.com/TryGhost/Team/issues/1233
2021-12-07 17:33:13 +01:00
Rishabh
52faba6dac Added dynamic play/pause and unmute state for audio card player
refs https://github.com/TryGhost/Team/issues/1230

- adds dynamic play/pause icon toggle for audio player
- adds dynamic mute/unmute icon toggle for mute behavior
- fixed volume slider not working
2021-12-07 20:43:20 +05:30
Sanne de Vries
986f731e60 Updated audio card frontend styles
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:47:36 +00:00
Sanne de Vries
259d40641d Updated audio card playback speed characters
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:16:04 +00:00
Sanne de Vries
b6544afff5 Updated audio card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:04:44 +00:00
James Morris
0aaa1b9c75 Removed more unnecessary styles from blockquote card styles
refs https://github.com/TryGhost/Team/issues/1239
2021-12-07 11:53:46 +00:00
James Morris
5c4cfc785f Removed blockquote selector from card styles plus email tweaks
refs https://github.com/TryGhost/Team/issues/1239
2021-12-07 11:35:58 +00:00
djordje vlaisavljevic
67b6304807 Made toggle card closed by default
refs https://github.com/TryGhost/Team/issues/1209
2021-12-06 22:15:54 +01:00
Sam Lord
97451a93cb
Extract logging from DI patterns, only use @tryghost/logging package
refs: https://github.com/TryGhost/Toolbox/issues/146

Switched to @tryghost/logging instead of passing around the library. The main sticking points of this change are jobs. When jobs are launched we don't want them to use a separate @tryghost/logging instance because they would start parallel rotation jobs. @tryghost/logging v2.x passes all logs to the parent process if run in a child process, so that we can use the same patterns in jobs and the rest of the codebase.
2021-12-06 18:00:55 +00:00
James Morris
5b34af9954 Tweaked AMP and email CSS and moved from REM to EM
refs https://github.com/TryGhost/Team/issues/1239
2021-12-06 13:08:02 +00:00
djordje vlaisavljevic
024f735844 Moved svg arrow styles from inline to CSS file
refs https://github.com/TryGhost/Team/issues/1209
2021-12-06 12:58:47 +01:00
Sanne de Vries
1bc64dc7e4 Fixed callout card link invisible on brand-color background in AMP 2021-12-06 11:02:21 +00:00
Rishabh
2aa353a1a0 Added custom audio player UI for audio card
refs https://github.com/TryGhost/Team/issues/1230

- adds custom css and js for custom audio card player
- bumps `kg-default-cards` to add custom audio player ui for theme
2021-12-06 14:24:41 +05:30
djordje vlaisavljevic
18be68a4bb Updated the spacing between toggle cards on frontend
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 17:55:26 +01:00
djordje vlaisavljevic
c229ada2b5 Updated toggle styles
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 16:41:50 +01:00
Sanne de Vries
c0d5711d6d Added link styling for callout card with brand color as background
Refs https://github.com/TryGhost/Team/issues/1206
2021-12-03 14:08:18 +00:00
Sanne de Vries
a07580b890 Updated callout card default styles
No ref

- Added default font sizes and line heights
- Switched from absolute to relative units to adapt to different themes
2021-12-03 13:28:19 +00:00
djordje vlaisavljevic
5c7e935b78 Removed the background from the arrow button
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 10:41:22 +01:00
Sanne de Vries
dae4cd7de6 Updated AMP styling for callout cards
Refs https://github.com/TryGhost/Team/issues/1206
2021-12-03 09:39:49 +00:00
djordje vlaisavljevic
07855bf8dc Updated toggle transition
refs https://github.com/TryGhost/Team/issues/1209
2021-12-02 19:42:38 +01:00
djordje vlaisavljevic
1a3b78bbff Fixed toggle transition
refs https://github.com/TryGhost/Team/issues/1209
2021-12-02 18:49:18 +01:00
James Morris
6f9fd79120 Add a basic style for alternative quote for AMP 2021-12-02 14:13:50 +00:00
James Morris
f13a49233c Add blockquote alternative card styling 2021-12-02 14:13:50 +00:00
Thibaut Patel
77c0364efd 🐛 Fixed malformed URLs crashing the url helper
refs https://github.com/TryGhost/Team/issues/960

- Character like "%%" or "%80" would crash our current url escaping behavior. We consider they aren't valid URLs as the percentages haven't been properly escaped.
2021-12-02 10:34:24 +01:00
Hannah Wolfe
ecbdb2284e
Fixed MIME type for public/cards.min.js part deux
refs: 580ebfad39

- correct mime type is application/javascript
- mime types are weird
2021-12-02 09:03:06 +00:00
Marat Vyshegorodtsev
580ebfad39
Fixed MIME type for public/cards.min.js (#13808)
- This script does not load if `x-content-type-options: nosniff` is enforced due to wrong MIME type
2021-12-02 09:01:18 +00:00
Sanne de Vries
ea50944897 Updated callout card class for consistency
No ref

- Swapped "kg-card-callout" for "kg-callout-card"
2021-12-01 14:25:33 +00:00
Peter Zimon
a727135800 Updateed Button styles to support alignment 2021-12-01 09:44:32 -04:00
Hannah Wolfe
9f11140ec4
Split theme engine middleware into separate files
- one big file full of stuff is never good for clarity
- separating it out helps us see what requires what
- it also highlights the awful naming and opaque behaviour we have in themes - much to do, but this helps us start
2021-12-01 12:04:36 +00:00
Sam Lord
18b8eddd0d Added linting for use of @tryghost/errors
refs: https://github.com/TryGhost/Toolbox/issues/147
Errors in @tryghost/errors rely on being called with an object (with a `message` member) rather than with a string.
2021-12-01 11:22:21 +00:00
Sam Lord
2887e416da
Switch to @tryghost/errors from ignition errors package (#13807)
refs: TryGhost/Toolbox#147

* Replaces all references to isIgnitionError with isGhostError
* Switches use of GhostError to InternalServerError - as GhostError is no longer public
There are places where InternalServerError is not the valid error, and new errors should be added to the @tryghost/errors package to ensure that we can use semantically correct errors in those cases.
2021-12-01 10:22:01 +00:00
Fabien egg O'Carroll
c77263f35b Redirected to original image when resizing fails
refs https://github.com/TryGhost/Team/issues/1234

Sharp can occasionally fail resizing, this is usually due the the
underlying libvips library failing. We do not want this to cause an
error however, instead we should just show the original image - as
resizing is an optimisation, rather than a requirement.
2021-12-01 10:42:27 +02:00
djordje vlaisavljevic
fb95fe2d48 Fixed Toggle card email view refs https://github.com/TryGhost/Team/issues/1209 2021-11-29 19:22:40 +01:00
Hannah Wolfe
ad9eb35746
Moved theme-specific error handling to frontend
- our themeErrorRenderer is only used in the frontend.. move it there
- this required exposing prepareError as shared middleware
- TODO: move these shared compontents to @tryghost/error
2021-11-29 17:04:01 +00:00
djordje vlaisavljevic
9655ad1e88 Fixed the selector for toggle headings 2021-11-25 09:07:47 +01:00
Sodbileg Gansukh
93f24575bb Improved gallery card mobile styling
Adds a self-contained CSS custom property for gap which makes it easier to change its value
2021-11-25 14:04:40 +08:00
Sodbileg Gansukh
48e1abae52 Improved bookmark card mobile styling 2021-11-25 13:56:05 +08:00
Hannah Wolfe
f417c4c732
Merged our two maintenance middleware into one
- Reduced our maintenance middleware code down to the bare minimum!
  - We have an old maintenance middleware in place to handle when a site is forcibly put into maintenance mode, or the urlService hasn't finished booting
    - This maintenance middleware was mounted on every sub app, instead of globally for reasons I no longer remember
  - Recently, we introduced a new, static version of maintenence middleware to show during the boot process so we can get the server started earlier & not drop requests
    - This version has its own HTML template and doesn't depend on any of Ghost's error rendering code
  - To simplify and help with decoupling, this commit merges the two middleware, so that the new independent & static middleware renders its template for any one of the 3 possible maintenance modes
    - It only needs to exist in the top level app 🙌

TODO: move the maintenance middleware to its own file/package so it's not part of the app.js as that is weird
2021-11-24 11:27:18 +00:00
Hannah Wolfe
4c7330125f
Improved error handling in card-assets
refs bb47b9e327

- EACCESS error was previously caught to stop the boot process from failing with perms errors
- For clearFiless, we do not care if these files cannot be removed. Refactored to use allSettled which means we don't do them in sequence + can ignore the outcome
- For minifiy, this is now a legit error, however we don't need the activate method to fail for an EACCES error, we just need an error to be shown (I think)
2021-11-23 17:24:49 +00:00
Hannah Wolfe
0ede559d5b
🐛 Fixed card asset init/reload behaviour
- Card asset reloading was incorrectly only happening if the API version changed 🙈
- In addition, having an init function was redundant, as theme activation happens on boot
- This meant that the card assets were being generated twice on boot
- Instead, we now only generate them on theme activation, which covers the boot case and simplifies all the logic
2021-11-23 12:53:58 +00:00