-
Notifications
You must be signed in to change notification settings - Fork 85
fix: mobile fixes and basic i18n support #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit also introduces an i18n property to the lesson object which is used to customize the rendering of any string that would inject a fixed string like "Next lesson: ". Support for string interpolation is also possible.
|
Deploying tutorialkit-demo-page with
|
Latest commit: |
f9dd9b4
|
Status: | ✅ Deploy successful! |
Preview URL: | https://14810557.tutorialkit-demo-page.pages.dev |
Branch Preview URL: | https://joan-mobile-fixes.tutorialkit-demo-page.pages.dev |
Deploying tutorialkit-docs-page with
|
Latest commit: |
ff7225e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://cedefcc6.tutorialkit-docs-page.pages.dev |
Branch Preview URL: | https://joan-mobile-fixes.tutorialkit-docs-page.pages.dev |
@@ -272,21 +282,6 @@ export async function getTutorial(): Promise<Tutorial> { | |||
return _tutorial; | |||
} | |||
|
|||
function pick<T extends Record<any, any>>(objects: (T | undefined)[], properties: (keyof T)[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is replaced by squash
and inheritProperties
which perform a deeper inheritance. This was something we wanted for the terminal
property but never got to implement. It was needed for the i18n
property as otherwise you couldn't really override a single property for a chapter or lesson.
@@ -18,7 +18,7 @@ const { lesson, logoLink, navList, title } = Astro.props as Props; | |||
|
|||
<Layout title={title}> | |||
<div id="previews-container"></div> | |||
<main class="max-w-full flex flex-col h-screen overflow-hidden" data-swap-root> | |||
<main class="max-w-full flex flex-col h-full overflow-hidden" data-swap-root> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed the issue of not seeing the buttons on the bottom of the page on mobile.
@@ -24,16 +24,35 @@ const baseURL = import.meta.env.BASE_URL; | |||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" /> | |||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap" rel="stylesheet" /> | |||
<ViewTransitions /> | |||
<script is:inline> | |||
setTutorialKitTheme(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this function as an inline script guarantee that we always add the theme attribute before any dom as been rendered which makes sure no transition animations are rendered.
Without this change, on dark mode a transition animation was visible on every page reload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work nice! 👍
docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx
Outdated
Show resolved
Hide resolved
docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Ari Perkkiö <[email protected]>
docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some optional improvement ideas but looks good to me! 🎉
packages/astro/src/default/components/PageLoadingIndicator.astro
Outdated
Show resolved
Hide resolved
progressEl.style.opacity = '1'; | ||
|
||
intervalId = setInterval(() => { | ||
const elapsedTime = Date.now() - startTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, that's the correct way to see elapsed time (instead of relying that setInterval(fn, 100)
actually calls every 100ms.) 💪
Co-authored-by: Ari Perkkiö <[email protected]>
c6b40f4
to
f9dd9b4
Compare
data: { | ||
template: 'default', | ||
i18n: { | ||
nextLessonPrefix: 'Next lesson: ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nemikolh now that nextLessonPrefix
was removed from source files, this test file is causing typescript errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good find! Dang, we should typecheck those files in CI. I'll fix them in #133
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b8c18c8
This PR:
loading-indicator.webm
i18n
in the metadata that you typically want to configure on the tutorial level to change the text of the UI:terminal
andi18n
so that not every property must be specified again if only one changed. Note that this only works for objects. For arrays, string and numbers the value is always overriden (which is typically what you'd want from TutorialKit's metadata).