Skip to content
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

feat(helpBubble): add Academy link and update text of existing links TASK-1466 #5437

Merged
merged 5 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions jsapp/js/components/support/helpBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,9 @@ class HelpBubble extends React.Component<{}, HelpBubbleState> {
onClick={this.close.bind(this)}
>
<i className='k-icon k-icon-help-articles' />
<header>{t('KoboToolbox Help Center')}</header>
<header>{t('Help Center')}</header>
<p>
{t(
'A vast collection of user support articles and tutorials related to Kobo'
)}
{t('Find answers in our extensive library of user support articles and tutorials.')}
</p>
</bem.HelpBubble__rowAnchor>
)}
Expand All @@ -164,12 +162,25 @@ class HelpBubble extends React.Component<{}, HelpBubbleState> {
href={envStore.data.community_url}
onClick={this.close.bind(this)}
>
<i className='k-icon k-icon-forum' />
<header>{t('KoboToolbox Community Forum')}</header>
<i className='k-icon k-icon-help-forum' />
<header>{t('Community Forum')}</header>
<p>
{t(
'Post your questions to get answers from experienced Kobo users around the world'
)}
{t('Connect with thousands of KoboToolbox users, ask questions, and share ideas.')}
</p>
</bem.HelpBubble__rowAnchor>
)}

{envStore.isReady && envStore.data.academy_url && (
<bem.HelpBubble__rowAnchor
m='link'
target='_blank'
href={envStore.data.academy_url}
onClick={this.close.bind(this)}
>
<i className='k-icon k-icon-help-academy' />
<header>{t('KoboToolbox Academy')}</header>
<p>
{t('Enroll in an online self-paced course designed by Kobo staff experts.')}
</p>
</bem.HelpBubble__rowAnchor>
)}
Expand Down
3 changes: 3 additions & 0 deletions jsapp/js/envStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface EnvironmentResponse {
support_email: string;
support_url: string;
community_url: string;
academy_url: string;
project_metadata_fields: EnvStoreFieldItem[];
user_metadata_fields: UserMetadataField[];
sector_choices: string[][];
Expand Down Expand Up @@ -101,6 +102,7 @@ export class EnvStoreData {
public support_email = '';
public support_url = '';
public community_url = '';
public academy_url = '';
public min_retry_time = 4; // seconds
public max_retry_time: number = 4 * 60; // seconds
public project_metadata_fields: EnvStoreFieldItem[] = [];
Expand Down Expand Up @@ -210,6 +212,7 @@ class EnvStore {
this.data.support_email = response.support_email;
this.data.support_url = response.support_url;
this.data.community_url = response.community_url;
this.data.academy_url = response.academy_url;
this.data.min_retry_time = response.frontend_min_retry_time;
this.data.max_retry_time = response.frontend_max_retry_time;
this.data.project_metadata_fields = response.project_metadata_fields;
Expand Down
1 change: 0 additions & 1 deletion jsapp/svg-icons/forum.svg

This file was deleted.

1 change: 1 addition & 0 deletions jsapp/svg-icons/help-academy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion jsapp/svg-icons/help-articles.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions jsapp/svg-icons/help-forum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions kobo/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@
env.str('KOBO_SUPPORT_URL', 'https://support.kobotoolbox.org/'),
'URL for "KoboToolbox Help Center"',
),
'ACADEMY_URL': (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why do we need to check the environment for these links?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed the same code for the other URLs. But yeah, maybe it's not necessary for this one

env.str(
'KOBO_ACADEMY_URL', 'https://academy.kobotoolbox.org/'
),
'URL for "KoboToolbox Community Forum"',
),
'COMMUNITY_URL': (
env.str(
'KOBO_COMMUNITY_URL', 'https://community.kobotoolbox.org/'
Expand Down Expand Up @@ -669,6 +675,7 @@
'SOURCE_CODE_URL',
'SUPPORT_EMAIL',
'SUPPORT_URL',
'ACADEMY_URL',
'COMMUNITY_URL',
'SYNCHRONOUS_EXPORT_CACHE_MAX_AGE',
'EXPOSE_GIT_REV',
Expand Down
5 changes: 3 additions & 2 deletions kpi/tests/api/test_api_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def setUp(self):
'source_code_url': constance.config.SOURCE_CODE_URL,
'support_email': constance.config.SUPPORT_EMAIL,
'support_url': constance.config.SUPPORT_URL,
'academy_url': constance.config.ACADEMY_URL,
'community_url': constance.config.COMMUNITY_URL,
'frontend_min_retry_time': constance.config.FRONTEND_MIN_RETRY_TIME,
'frontend_max_retry_time': constance.config.FRONTEND_MAX_RETRY_TIME,
Expand Down Expand Up @@ -316,7 +317,7 @@ def test_free_tier_override_uses_organization_owner_join_date(
def test_social_apps(self):
# GET mutates state, call it first to test num queries later
self.client.get(self.url, format='json')
queries = FuzzyInt(18, 27)
queries = FuzzyInt(18, 28)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Not disagreeing with it but I'm just not sure where this is coming from

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this checks how many things are there in environment endpoint, and since we've added one, it needs to be increased:)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a new constance configuration parameter brings an additional DB query

with self.assertNumQueries(queries):
response = self.client.get(self.url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand All @@ -335,7 +336,7 @@ def test_social_apps(self):
def test_social_apps_no_custom_data(self):
SocialAppCustomData.objects.all().delete()
self.client.get(self.url, format='json')
queries = FuzzyInt(18, 27)
queries = FuzzyInt(18, 28)
with self.assertNumQueries(queries):
response = self.client.get(self.url, format='json')

Expand Down
1 change: 1 addition & 0 deletions kpi/views/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class EnvironmentView(APIView):
'SOURCE_CODE_URL',
'SUPPORT_EMAIL',
'SUPPORT_URL',
'ACADEMY_URL',
'COMMUNITY_URL',
'FRONTEND_MIN_RETRY_TIME',
'FRONTEND_MAX_RETRY_TIME',
Expand Down