Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

refactor: Home and ShowIdea pages, including saving filtered tags on url (#196)

Guilherme Oenning96295dbe6cc3
diff --git a/public/assets/styles/main.scss b/public/assets/styles/main.scss
index 11ea2a1af..e10ad5ffd 100644
--- a/public/assets/styles/main.scss
+++ b/public/assets/styles/main.scss
@@ -31,7 +31,7 @@ body {
}
.info {
- font-size: 90%;
+ font-size: 80%;
color: rgba(0,0,0,.6);
}
diff --git a/public/assets/styles/semantic.scss b/public/assets/styles/semantic.scss
index 63625e8ef..8401cccb2 100644
--- a/public/assets/styles/semantic.scss
+++ b/public/assets/styles/semantic.scss
@@ -9,4 +9,11 @@
}
}
}
+}
+
+
+.ui.label {
+ .icon {
+ margin-right: 0.25em;
+ }
}
\ No newline at end of file
diff --git a/public/components/index.tsx b/public/components/index.tsx
new file mode 100644
index 000000000..ca723d5f2
--- /dev/null
+++ b/public/components/index.tsx
@@ -0,0 +1,5 @@
+export * from './ShowIdeaResponse';
+export * from './ShowTag';
+export * from './SignInModal';
+export * from './SupportCounter';
+export * from './common';
diff --git a/public/pages/site/HomePage/HomePage.tsx b/public/pages/site/HomePage/HomePage.tsx
index 2c7e18645..f8bbf6d81 100644
--- a/public/pages/site/HomePage/HomePage.tsx
+++ b/public/pages/site/HomePage/HomePage.tsx
@@ -1,17 +1,11 @@
import * as React from 'react';
import { Idea, Tag, IdeaStatus, CurrentUser, Tenant } from '@fider/models';
-import { Gravatar, MultiLineText, Moment, Header, Footer } from '@fider/components/common';
-import { ShowIdeaResponse } from '@fider/components/ShowIdeaResponse';
-import { SupportCounter } from '@fider/components/SupportCounter';
-import { ShowTag } from '@fider/components/ShowTag';
-import { IdeaInput } from './IdeaInput';
-import { IdeaFilter, IdeaFilterFunction } from './IdeaFilter';
+import { ShowTag, ShowIdeaResponse, SupportCounter, Gravatar, MultiLineText, Moment, Header, Footer } from '@fider/components';
+import { IdeaInput, TagsFilter, IdeaFilter, IdeaFilterFunction } from './';
import { inject, injectables } from '@fider/di';
import { Session } from '@fider/services';
-import { getBaseUrl, getQueryString } from '@fider/utils/page';
-
-import { TagsFilter } from './TagsFilter';
+import { getBaseUrl, getQueryString, getQueryStringArray } from '@fider/utils/page';
import './HomePage.scss';
@@ -19,10 +13,11 @@ const defaultShowCount = 20;
interface HomePageState {
ideas: Idea[];
+ search?: string;
showCount: number;
searching: boolean;
- search?: string;
activeFilter: string;
+ tags: string[];
}
const EmptyList = () => {
@@ -78,13 +73,15 @@ export class HomePage extends React.Component<{}, HomePageState> {
this.allTags = this.session.getArray<Tag>('tags');
const search = getQueryString('q');
+ const tags = getQueryStringArray('t');
const activeFilter = window.location.hash.substring(1);
this.state = {
- ideas: this.filterIdeas(activeFilter, search),
+ ideas: this.filterIdeas(activeFilter, search, tags),
showCount: defaultShowCount,
activeFilter,
searching: !!search,
- search
+ search,
+ tags
};
}
@@ -97,24 +94,21 @@ export class HomePage extends React.Component<{}, HomePageState> {
return true;
}
- private selectedTagsChanged(tags: number[]): void {
- const ideas = this.filterIdeas(this.state.activeFilter, this.state.search);
+ private selectedTagsChanged(tags: string[]): void {
+ const ideas = this.filterIdeas(this.state.activeFilter, this.state.search, tags);
this.setState({
- ideas: ideas.filter(
- (i) => i.tags.filter(
- (t) => tags.indexOf(t) >= 0
- ).length === tags.length
- ),
+ ideas,
+ tags,
});
}
- private filterIdeas(activeFilter: string, search: string | undefined): Idea[] {
- let newUrl = getBaseUrl();
+ private filterIdeas(activeFilter: string, search: string | undefined, tags: string[]): Idea[] {
+ let path = '';
let ideas = [];
if (search) {
const s = search.trim().toLowerCase();
- newUrl += `?q=${encodeURIComponent(s).replace(/%20/g, '+')}`;
+ path += `?q=${encodeURIComponent(s).replace(/%20/g, '+')}`;
ideas = this.allIdeas.filter((idea) => {
const terms = s.split(' ').filter((x) => x.length >= 2);
return (
@@ -124,20 +118,35 @@ export class HomePage extends React.Component<{}, HomePageState> {
);
});
} else {
- newUrl += activeFilter ? `#${activeFilter}` : '';
+ path += activeFilter ? `#${activeFilter}` : '';
ideas = IdeaFilter.getFilter(activeFilter)(this.allIdeas);
}
+ if (tags.length > 0) {
+ const prefix = (!path) ? '?' : '&';
+ path += `${prefix}t=${tags.join(',')}`;
+ }
+
if (history.replaceState) {
+ const newUrl = getBaseUrl() + path;
window.history.replaceState({ path: newUrl }, '', newUrl);
}
+ if (tags.length > 0) {
+ const tagsToFilter = this.allTags.filter((x) => tags.indexOf(x.slug) >= 0).map((x) => x.id);
+ ideas = ideas.filter(
+ (i) => i.tags.filter(
+ (t) => tagsToFilter.indexOf(t) >= 0
+ ).length === tagsToFilter.length
+ );
+ }
+
return ideas;
}
private filterChanged(name: string) {
this.setState({
- ideas: this.filterIdeas(name, this.state.search),
+ ideas: this.filterIdeas(name, this.state.search, this.state.tags),
showCount: defaultShowCount,
activeFilter: name,
});
@@ -154,14 +163,14 @@ export class HomePage extends React.Component<{}, HomePageState> {
this.setState({
search: '',
searching: false,
- ideas: this.filterIdeas(this.state.activeFilter, ''),
+ ideas: this.filterIdeas(this.state.activeFilter, '', this.state.tags),
});
}
private searchIdea(input: string): void {
this.setState({
search: input,
- ideas: this.filterIdeas(this.state.activeFilter, input)
+ ideas: this.filterIdeas(this.state.activeFilter, input, this.state.tags)
});
}
@@ -239,7 +248,11 @@ We'd love to hear what you're thinking about. What can we do better? This is the
</div>
</div>
</div>
- <TagsFilter tags={this.allTags} selectionChanged={(selected) => this.selectedTagsChanged(selected)} />
+ <TagsFilter
+ tags={this.allTags}
+ selectionChanged={(selected) => this.selectedTagsChanged(selected)}
+ defaultSelection={this.state.tags}
+ />
{displayIdeas}
</div>
}
diff --git a/public/pages/site/HomePage/IdeaFilter.tsx b/public/pages/site/HomePage/IdeaFilter.tsx
index 7e520edd2..6a2c8269a 100644
--- a/public/pages/site/HomePage/IdeaFilter.tsx
+++ b/public/pages/site/HomePage/IdeaFilter.tsx
@@ -17,11 +17,11 @@ const filterers: {[key: string]: (idea: Idea) => boolean} = {
};
const names: {[key: string]: string} = {
- 'recent': 'recent ideas',
- 'most-wanted': 'most wanted ideas',
- 'most-discussed': 'most discussed ideas',
- 'completed': 'completed ideas',
- 'declined': 'declined ideas'
+ 'recent': 'recent',
+ 'most-wanted': 'most wanted',
+ 'most-discussed': 'most discussed',
+ 'completed': 'completed',
+ 'declined': 'declined'
};
const sorterers: {[key: string]: (left: Idea, right: Idea) => number} = {
@@ -70,11 +70,11 @@ export class IdeaFilter extends React.Component<IdeaFilterProps, {}> {
<i className="dropdown icon" />
<div className="menu">
<div className="header">What do you want to see?</div>
- <div className={`item ${activeFilter === 'recent' && 'active'}`} data-value="recent" data-text="recent ideas">Recent</div>
- <div className={`item ${activeFilter === 'most-wanted' && 'active'}`} data-value="most-wanted" data-text="most wanted ideas">Most Wanted</div>
- <div className={`item ${activeFilter === 'most-discussed' && 'active'}`} data-value="most-discussed" data-text="most discussed ideas">Most Discussed</div>
- <div className={`item ${activeFilter === 'completed' && 'active'}`} data-value="completed" data-text="completed ideas">Completed</div>
- <div className={`item ${activeFilter === 'declined' && 'active'}`} data-value="declined" data-text="declined ideas">Declined</div>
+ <div className={`item ${activeFilter === 'recent' && 'active'}`} data-value="recent" data-text="recent">Recent</div>
+ <div className={`item ${activeFilter === 'most-wanted' && 'active'}`} data-value="most-wanted" data-text="most wanted">Most Wanted</div>
+ <div className={`item ${activeFilter === 'most-discussed' && 'active'}`} data-value="most-discussed" data-text="most discussed">Most Discussed</div>
+ <div className={`item ${activeFilter === 'completed' && 'active'}`} data-value="completed" data-text="completed">Completed</div>
+ <div className={`item ${activeFilter === 'declined' && 'active'}`} data-value="declined" data-text="declined">Declined</div>
</div>
</div>
</div>
diff --git a/public/pages/site/HomePage/TagsFilter.tsx b/public/pages/site/HomePage/TagsFilter.tsx
index 83fd9971e..543bc35eb 100644
--- a/public/pages/site/HomePage/TagsFilter.tsx
+++ b/public/pages/site/HomePage/TagsFilter.tsx
@@ -4,11 +4,12 @@ import { ShowTag } from '@fider/components/ShowTag';
interface TagsFilterProps {
tags: Tag[];
- selectionChanged: (selected: number[]) => void;
+ defaultSelection: string[];
+ selectionChanged: (selected: string[]) => void;
}
interface TagsFilterState {
- selected: number[];
+ selected: string[];
}
export class TagsFilter extends React.Component<TagsFilterProps, TagsFilterState> {
@@ -17,21 +18,24 @@ export class TagsFilter extends React.Component<TagsFilterProps, TagsFilterState
constructor(props: TagsFilterProps) {
super(props);
this.state = {
- selected: []
+ selected: props.defaultSelection
};
}
public componentDidMount() {
- $(this.element).dropdown({
+ const $element = $(this.element);
+ this.props.defaultSelection.forEach((t) => {
+ $element.dropdown('set selected', t);
+ });
+ $element.dropdown({
onAdd: (value: string) => {
const id = parseInt(value, 10);
- const selected = this.state.selected.concat(id);
+ const selected = this.state.selected.concat(value);
this.setState({ selected });
this.props.selectionChanged(selected);
},
onRemove: (value: string) => {
- const id = parseInt(value, 10);
- const idx = this.state.selected.indexOf(id);
+ const idx = this.state.selected.indexOf(value);
const selected = this.state.selected.splice(idx, 1) && this.state.selected;
this.setState({ selected });
this.props.selectionChanged(selected);
@@ -62,7 +66,7 @@ export class TagsFilter extends React.Component<TagsFilterProps, TagsFilterState
<div className="scrolling menu">
{
this.props.tags.map((t) => (
- <div key={t.id} className="item" data-value={t.id}>
+ <div key={t.id} className="item" data-value={t.slug}>
<ShowTag tag={t} circular={true}/>
{t.name}
</div>
diff --git a/public/pages/site/HomePage/index.ts b/public/pages/site/HomePage/index.ts
index 11e53da67..a110bc3db 100644
--- a/public/pages/site/HomePage/index.ts
+++ b/public/pages/site/HomePage/index.ts
@@ -1 +1,5 @@
export * from './HomePage';
+export * from './TagsFilter';
+export * from './IdeaFilter';
+export * from './HomePage';
+export * from './IdeaInput';
diff --git a/public/pages/site/ShowIdeaPage/CommentList.tsx b/public/pages/site/ShowIdeaPage/CommentList.tsx
new file mode 100644
index 000000000..66996baad
--- /dev/null
+++ b/public/pages/site/ShowIdeaPage/CommentList.tsx
@@ -0,0 +1,30 @@
+import * as React from 'react';
+import { Comment } from '@fider/models';
+import { UserName, Gravatar, Moment, MultiLineText } from '@fider/components/common';
+
+interface CommentListProps {
+ comments: Comment[];
+}
+
+export class CommentList extends React.Component<CommentListProps, {}> {
+ constructor(props: CommentListProps) {
+ super(props);
+ }
+
+ public render() {
+ return this.props.comments.map((c) => (
+ <div key={c.id} className="comment">
+ <Gravatar user={c.user} />
+ <div className="content">
+ <UserName user={c.user} />
+ <div className="metadata">
+ · <Moment date={c.createdOn} />
+ </div>
+ <div className="text">
+ <MultiLineText text={c.content} style="simple" />
+ </div>
+ </div>
+ </div>
+ ));
+ }
+}
diff --git a/public/pages/site/ShowIdeaPage/ShowIdeaPage.scss b/public/pages/site/ShowIdeaPage/ShowIdeaPage.scss
index 7ed8cb0e9..a209e1b03 100644
--- a/public/pages/site/ShowIdeaPage/ShowIdeaPage.scss
+++ b/public/pages/site/ShowIdeaPage/ShowIdeaPage.scss
@@ -12,19 +12,28 @@
}
}
- .subtitle {
- display: block;
- &.active {
- cursor: pointer;
- &:hover {
- color: $main-color;
- }
- i {
- float: right;
+ .action-col {
+ @media only screen and (min-width: 768px) {
+ height: 0;
+ }
+ .ui.list {
+ margin: 0.5em 0em;
+ }
+ .subtitle {
+ display: block;
+ &.active {
+ cursor: pointer;
+ &:hover {
+ color: $main-color;
+ }
+ i {
+ float: right;
+ }
}
}
}
+
.tag-list {
.tag-icon {
width: 10px;
@@ -62,7 +71,7 @@
}
.comment-input {
- margin-top: 10px;
+ margin-top: 0.3em;
textarea {
margin-top: 5px;
diff --git a/public/pages/site/ShowIdeaPage/ShowIdeaPage.tsx b/public/pages/site/ShowIdeaPage/ShowIdeaPage.tsx
index 46e82f76b..a87504265 100644
--- a/public/pages/site/ShowIdeaPage/ShowIdeaPage.tsx
+++ b/public/pages/site/ShowIdeaPage/ShowIdeaPage.tsx
@@ -1,25 +1,20 @@
import * as React from 'react';
+import { inject, injectables } from '@fider/di';
import { CurrentUser, Comment, Idea, Tag } from '@fider/models';
+import { Session, IdeaService, Failure } from '@fider/services';
+
import { setTitle } from '@fider/utils/page';
-import { SupportCounter } from '@fider/components/SupportCounter';
-import { ShowIdeaResponse } from '@fider/components/ShowIdeaResponse';
-import { CommentInput } from './CommentInput';
-import { ResponseForm } from './ResponseForm';
-import { ShowTag } from '@fider/components/ShowTag';
-import { DisplayError, Button, Textarea, UserName, Gravatar, Moment, Form, MultiLineText, Footer, Header, SocialSignInButton } from '@fider/components/common';
-import { inject, injectables } from '@fider/di';
-import { Session, IdeaService, TagService, Failure } from '@fider/services';
+import { TagsPanel, CommentInput, CommentList, ResponseForm } from './';
+import { SupportCounter, ShowIdeaResponse, DisplayError, Button, Textarea, UserName, Gravatar, Moment, Form, MultiLineText, Footer, Header } from '@fider/components';
import './ShowIdeaPage.scss';
interface ShowIdeaPageState {
editMode: boolean;
- editTags: boolean;
newTitle: string;
newDescription: string;
- assignedTags: Tag[];
error?: Failure;
}
@@ -35,9 +30,6 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
@inject(injectables.IdeaService)
public ideaService: IdeaService;
- @inject(injectables.TagService)
- public tagService: TagService;
-
constructor(props: {}) {
super(props);
@@ -48,10 +40,8 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
this.state = {
editMode: false,
- editTags: false,
newTitle: this.idea.title,
newDescription: this.idea.description,
- assignedTags: this.tags.filter((t) => this.idea.tags.indexOf(t.id) >= 0),
};
setTitle(`${this.idea.title} · ${document.title}`);
@@ -74,57 +64,12 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
}
}
- private async assignOrUnassignTag(tag: Tag) {
- const idx = this.state.assignedTags.indexOf(tag);
- let assignedTags: Tag[] = [];
- if (idx >= 0) {
- const response = await this.tagService.unassign(tag.slug, this.idea.number);
- if (response.ok) {
- assignedTags = this.state.assignedTags.splice(idx, 1) && this.state.assignedTags;
- }
- } else {
- const response = await this.tagService.assign(tag.slug, this.idea.number);
- if (response.ok) {
- assignedTags = this.state.assignedTags.concat(tag);
- }
- }
-
- this.setState({
- assignedTags
- });
- }
-
public render() {
- const commentsList = this.comments.map((c) => (
- <div key={c.id} className="comment">
- <Gravatar user={c.user} />
- <div className="content">
- <UserName user={c.user} />
- <div className="metadata">
- · <Moment date={c.createdOn} />
- </div>
- <div className="text">
- <MultiLineText text={c.content} style="simple" />
- </div>
- </div>
- </div>
- ));
-
- const tagsList = this.state.assignedTags.length
- ?
- this.state.assignedTags.map((tag) => (
- <div key={tag.id} className="item">
- <ShowTag tag={tag} />
- </div>
- ))
- :
- <span className="info">None yet</span>;
-
return (
<div>
<Header />
<div className="page ui container">
- <div className="ui stackable grid container">
+ <div className="ui stackable vertically padded grid container">
<div className="thirteen wide column">
<div className="ui items unstackable">
<div className="item">
@@ -137,7 +82,7 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
<input type="text" onChange={(e) => this.setState({ newTitle: e.currentTarget.value })} defaultValue={this.state.newTitle} />
</div>,
<DisplayError key={0} fields={['title']} pointing="above" error={this.state.error} />
- ]
+ ]
: <h1 className="ui header">{this.idea.title}</h1>
}
@@ -165,8 +110,7 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
<ShowIdeaResponse status={this.idea.status} response={this.idea.response} />
</div>
-
- <div className="three wide column">
+ <div className="three wide column action-col">
{
this.session.isCollaborator() && [
<span key={0} className="subtitle">Actions</span>,
@@ -198,38 +142,16 @@ export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {
]
}
- <span
- className={`subtitle ${this.session.isCollaborator() && this.tags.length > 0 && 'active'}`}
- onClick={() => this.session.isCollaborator() && this.tags.length > 0 && this.setState({ editTags: !this.state.editTags })}
- >
- Tags
- {this.session.isCollaborator() && this.tags.length > 0 && <i className="setting icon" />}
- </span>
-
- <div className="ui list tag-list">
- {
- !this.state.editTags && tagsList
- }
- {
- this.state.editTags &&
- this.tags.map((tag) => (
- <div key={tag.id} className="item selectable" onClick={async () => this.assignOrUnassignTag(tag)}>
- <i className={`icon ${this.state.assignedTags.indexOf(tag) >= 0 && 'check'}`} />
- <ShowTag tag={tag} circular={true}/>
- <span>{tag.name}</span>
- </div>
- ))
- }
- </div>
+ <TagsPanel idea={this.idea} tags={this.tags} />
</div>
-
- <div className="sixteen wide column">
+ <div className="thirteen wide column">
<div className="ui comments">
<span className="subtitle">Discussion</span>
- {commentsList}
+ <CommentList comments={this.comments} />
<CommentInput idea={this.idea} />
</div>
</div>
+
</div>
</div>
diff --git a/public/pages/site/ShowIdeaPage/TagsPanel.tsx b/public/pages/site/ShowIdeaPage/TagsPanel.tsx
new file mode 100644
index 000000000..ffe1829a1
--- /dev/null
+++ b/public/pages/site/ShowIdeaPage/TagsPanel.tsx
@@ -0,0 +1,108 @@
+import * as React from 'react';
+import { Tag, Idea } from '@fider/models';
+import { inject, injectables } from '@fider/di';
+import { Session, TagService } from '@fider/services';
+
+import { ShowTag } from '@fider/components';
+
+interface TagsPanelProps {
+ idea: Idea;
+ tags: Tag[];
+}
+
+interface TagsPanelState {
+ canEdit: boolean;
+ assignedTags: Tag[];
+ isEditing: boolean;
+}
+
+export class TagsPanel extends React.Component<TagsPanelProps, TagsPanelState> {
+
+ @inject(injectables.Session)
+ public session: Session;
+
+ @inject(injectables.TagService)
+ public tagService: TagService;
+
+ constructor(props: TagsPanelProps) {
+ super(props);
+ this.state = {
+ canEdit: this.session.isCollaborator() === true && this.props.tags.length > 0,
+ isEditing: false,
+ assignedTags: this.props.tags.filter((t) => this.props.idea.tags.indexOf(t.id) >= 0),
+ };
+ }
+
+ private async assignOrUnassignTag(tag: Tag) {
+ const idx = this.state.assignedTags.indexOf(tag);
+ let assignedTags: Tag[] = [];
+ if (idx >= 0) {
+ const response = await this.tagService.unassign(tag.slug, this.props.idea.number);
+ if (response.ok) {
+ assignedTags = this.state.assignedTags.splice(idx, 1) && this.state.assignedTags;
+ }
+ } else {
+ const response = await this.tagService.assign(tag.slug, this.props.idea.number);
+ if (response.ok) {
+ assignedTags = this.state.assignedTags.concat(tag);
+ }
+ }
+
+ this.setState({
+ assignedTags
+ });
+ }
+
+ private onSubtitleClick = () => {
+ if (this.state.canEdit) {
+ this.setState({ isEditing: !this.state.isEditing });
+ }
+ }
+
+ public render() {
+ if (!this.state.canEdit && this.state.assignedTags.length === 0) {
+ return null;
+ }
+
+ const tagsList = this.state.assignedTags.length > 0
+ ? (
+ <div className="ui list tag-list">
+ {
+ this.state.assignedTags.map((tag) => (
+ <div key={tag.id} className="item">
+ <ShowTag tag={tag} />
+ </div>
+ ))
+ }
+ </div>
+ ) : <span className="info">None yet</span>;
+
+ const editTagsList = this.props.tags.length > 0 && (
+ <div className="ui list tag-list">
+ {
+ this.props.tags.map((tag) => (
+ <div key={tag.id} className="item selectable" onClick={async () => this.assignOrUnassignTag(tag)}>
+ <i className={`icon ${this.state.assignedTags.indexOf(tag) >= 0 && 'check'}`} />
+ <ShowTag tag={tag} circular={true}/>
+ <span>{tag.name}</span>
+ </div>
+ ))
+ }
+ </div>
+ );
+
+ const subtitleClasses = `subtitle ${this.state.canEdit && 'active'}`;
+ const icon = this.state.canEdit && (this.state.isEditing ? <i className="check circle icon" /> : <i className="setting icon" />);
+
+ return (
+ <div>
+ <span className={subtitleClasses} onClick={this.onSubtitleClick}>
+ Tags {icon}
+ </span>
+
+ {!this.state.isEditing && tagsList}
+ {this.state.isEditing && editTagsList}
+ </div>
+ );
+ }
+}
diff --git a/public/pages/site/ShowIdeaPage/index.ts b/public/pages/site/ShowIdeaPage/index.ts
index e17ca84c2..a3ceca324 100644
--- a/public/pages/site/ShowIdeaPage/index.ts
+++ b/public/pages/site/ShowIdeaPage/index.ts
@@ -1 +1,5 @@
export * from './ShowIdeaPage';
+export * from './CommentInput';
+export * from './ResponseForm';
+export * from './CommentList';
+export * from './TagsPanel';
diff --git a/public/tsd.d.ts b/public/tsd.d.ts
index d3a1e6fab..9e2b604fb 100644
--- a/public/tsd.d.ts
+++ b/public/tsd.d.ts
@@ -1,5 +1,5 @@
interface JQuery {
modal(opts: any): any;
popup(args: any): any;
- dropdown(args?: any): any;
+ dropdown(args?: any, args2?: any): any;
}
diff --git a/public/utils/page.ts b/public/utils/page.ts
index f86ede980..b072f4361 100644
--- a/public/utils/page.ts
+++ b/public/utils/page.ts
@@ -40,3 +40,12 @@ export function getQueryString(name: string): string {
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
+
+export function getQueryStringArray(name: string): string[] {
+ const qs = getQueryString(name);
+ if (qs) {
+ return qs.split(',').filter((i) => i);
+ }
+
+ return [];
+}