Skip to content

Commit

Permalink
Change which issue types are shown based on the variant.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Oct 2, 2023
1 parent ecd985a commit 9c39896
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/www/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"contact-view-issue-cannot-add-server": "I am having trouble adding a server using my access key",
"contact-view-issue-connection": "I am having trouble connecting to my Outline VPN server",
"contact-view-issue-general": "General feedback & suggestions",
"contact-view-issue-installation": "I am having trouble installing Outline",
"contact-view-issue-managing": "I need assistance managing my Outline VPN server or helping others connect to it",
"contact-view-issue-no-server": "I need an access key",
"contact-view-issue-performance": "My internet access is slow while connected to my Outline VPN server",
Expand Down
18 changes: 15 additions & 3 deletions src/www/views/contact_view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ export class ContactView extends LitElement {
`,
];

private static readonly ISSUES = Object.values(IssueType);
private static readonly ISSUES: {[key in AppType]: IssueType[]} = {
[AppType.CLIENT]: [
IssueType.NO_SERVER,
IssueType.CANNOT_ADD_SERVER,
IssueType.CONNECTION,
IssueType.PERFORMANCE,
IssueType.GENERAL,
],
[AppType.MANAGER]: [IssueType.CANNOT_ADD_SERVER, IssueType.CONNECTION, IssueType.MANAGING, IssueType.GENERAL],
};

@property({type: Function}) localize: Localizer = msg => msg;
@property({type: String}) variant: AppType = AppType.CLIENT;
Expand Down Expand Up @@ -137,7 +146,7 @@ export class ContactView extends LitElement {
}

private selectIssue(e: SingleSelectedEvent) {
this.selectedIssueType = ContactView.ISSUES[e.detail.index];
this.selectedIssueType = ContactView.ISSUES[this.variant][e.detail.index];

if (UNSUPPORTED_ISSUE_TYPE_HELPPAGES.has(this.selectedIssueType)) {
// TODO: Send users to localized support pages based on chosen language.
Expand Down Expand Up @@ -212,6 +221,9 @@ export class ContactView extends LitElement {
}

render() {
console.log(this.variant);
console.log(ContactView.ISSUES[this.variant]);

switch (this.step) {
case Step.FORM: {
return html` ${this.renderIntroTemplate} ${this.renderForm} `;
Expand Down Expand Up @@ -252,7 +264,7 @@ export class ContactView extends LitElement {
?hidden=${!this.showIssueSelector}
@selected="${this.selectIssue}"
>
${ContactView.ISSUES.map(value => {
${ContactView.ISSUES[this.variant].map(value => {
return html`
<mwc-list-item value="${value}">
<span>${this.localize(`contact-view-issue-${value}`)}</span>
Expand Down
1 change: 0 additions & 1 deletion src/www/views/contact_view/issue_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

/** Supported issue types in the feedback flow. */
export enum IssueType {
INSTALLATION = 'installation',
NO_SERVER = 'no-server',
CANNOT_ADD_SERVER = 'cannot-add-server',
CONNECTION = 'connection',
Expand Down

0 comments on commit 9c39896

Please sign in to comment.