UX: Move Admin Guide link to URL (#22789)

Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
Bianca Nenciu 2023-07-31 16:30:27 +02:00 committed by GitHub
parent 6e8e3c3151
commit a68752df25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 11 deletions

View File

@ -5,12 +5,7 @@
{{did-insert this.setupUserTip}}
>
{{#if this.showUserTip}}
<UserTip
@id="admin_guide"
@buttonLabel="user_tips.admin_guide.button"
@buttonIcon="link"
@onDismiss={{this.routeToAdminGuide}}
/>
<UserTip @id="admin_guide" @content={{this.userTipContent}} />
{{else}}
<DTooltip @theme="user-tip" @arrow={{true}}>
<div class="user-tip__container">
@ -18,7 +13,7 @@
{{i18n "user_tips.admin_guide.title"}}
</div>
<div class="user-tip__content">
{{i18n "user_tips.admin_guide.content"}}
{{i18n "user_tips.admin_guide.content_no_url"}}
</div>
</div>
</DTooltip>

View File

@ -1,7 +1,9 @@
import getURL from "discourse-common/lib/get-url";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import I18n from "I18n";
import DiscourseURL from "discourse/lib/url";
export default class BootstrapModeNotice extends Component {
@ -22,4 +24,14 @@ export default class BootstrapModeNotice extends Component {
`/t/-/${this.siteSettings.admin_quick_start_topic_id}`
);
}
get adminGuideUrl() {
return getURL(`/t/-/${this.siteSettings.admin_quick_start_topic_id}`);
}
get userTipContent() {
return I18n.t("user_tips.admin_guide.content", {
admin_guide_url: this.adminGuideUrl,
});
}
}

View File

@ -29,7 +29,8 @@ export default class UserTip extends Component {
this.currentUser.showUserTip({
id,
titleText: I18n.t(`user_tips.${id}.title`),
contentText: content || I18n.t(`user_tips.${id}.content`),
contentHtml: content,
contentText: I18n.t(`user_tips.${id}.content`),
buttonLabel,
buttonIcon,
reference:

View File

@ -90,7 +90,9 @@ export function showUserTip(options) {
options.content ||
`<div class='user-tip__container'>
<div class='user-tip__title'>${escape(options.titleText)}</div>
<div class='user-tip__content'>${escape(options.contentText)}</div>
<div class='user-tip__content'>${
options.contentHtml || escape(options.contentText)
}</div>
<div class='user-tip__buttons'>
<button class="btn btn-primary">${buttonText}</button>
</div>

View File

@ -45,6 +45,11 @@
&__content {
margin-top: 0.25em;
a {
color: var(--secondary);
text-decoration: underline;
}
}
&__buttons {

View File

@ -1933,8 +1933,8 @@ en:
admin_guide:
title: "Welcome to your new site!"
content: "Read the admin guide to continue building your site and community."
button: "Let's go!"
content: "<a href='%{admin_guide_url}'>Read the admin guide</a> to continue building your site and community."
content_no_url: "Read the admin guide to continue building your site and community."
loading: "Loading..."
errors: