Skip to content

Commit

Permalink
fix(search): match figma styles and remove outdated test
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg authored and stavares843 committed Apr 11, 2022
1 parent 96c97d0 commit cd9bb71
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 51 deletions.
7 changes: 0 additions & 7 deletions components/views/chat/search/SearchUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ describe('SearchUtil.default.getSearchResultGroupList', () => {
})
})

describe('SearchUtil.default.getSearchOrderTypeList', () => {
test('0', () => {
const result: any = SearchUtil.default.getSearchOrderTypeList()
expect(result).toMatchSnapshot()
})
})

describe('SearchUtil.default.getCommandMeta', () => {
test('0', () => {
const result: any = SearchUtil.default.getCommandMeta(
Expand Down
18 changes: 0 additions & 18 deletions components/views/chat/search/SearchUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
SearchCommandType,
SearchCommandTypeParam,
SearchOption,
SearchOrderType,
SearchQueryItem,
SearchRecommend,
SearchRecommendResultItem,
Expand Down Expand Up @@ -98,22 +97,6 @@ export const searchCommandMetaList = [
},
] as SearchCommandMeta[]

const searchOrderTypeList = [
{
type: SearchOrderType.New,
title: 'New',
},

{
type: SearchOrderType.Old,
title: 'Old',
},
{
type: SearchOrderType.Relevant,
title: 'Relevant',
},
]

const searchResultGroupList = [
{
type: SearchResultGroupType.Messages,
Expand Down Expand Up @@ -142,7 +125,6 @@ const SearchUtil = {
getCommandTypeParams: () => searchCommandTypeParams,
getCommandMetaList: () => searchCommandMetaList,
getSearchResultGroupList: () => searchResultGroupList,
getSearchOrderTypeList: () => searchOrderTypeList,
/**
* @method getCommandMeta DocsTODO
* @description
Expand Down
17 changes: 0 additions & 17 deletions components/views/chat/search/__snapshots__/SearchUtil.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,6 @@ Object {
}
`;

exports[`SearchUtil.default.getSearchOrderTypeList 0 1`] = `
Array [
Object {
"title": "New",
"type": undefined,
},
Object {
"title": "Old",
"type": undefined,
},
Object {
"title": "Relevant",
"type": undefined,
},
]
`;

exports[`SearchUtil.default.getSearchResultGroupList 0 1`] = `
Array [
Object {
Expand Down
2 changes: 1 addition & 1 deletion components/views/chat/search/result/Result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default Vue.extend({
groupList: SearchUtil.getSearchResultGroupList(),
query: '' as string,
groupBy: SearchResultGroupType.Messages as SearchResultGroupType,
orderBy: SearchOrderType.NEW as SearchOrderType,
orderBy: SearchOrderType.New as SearchOrderType,
channels: [],
date: null,
result: [] as UISearchResult[],
Expand Down
5 changes: 3 additions & 2 deletions components/views/chat/search/result/meta/Meta.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
}
.result-orderby {
display: flex;
gap: @normal-spacing;
.orderby-item {
&:extend(.font-muted);
cursor: pointer;
padding: 2px 8px;
&.active {
font-weight: bold;
&:extend(.font-secondary);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions store/textile/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,13 +960,13 @@ export default {
...match,
user: accounts.find((acct) => acct?.textilePubkey === match.from),
}))
if (orderBy === SearchOrderType.NEW) {
if (orderBy === SearchOrderType.New) {
data.sort((a: UISearchResultData, b: UISearchResultData) => b.at - a.at)
}
if (orderBy === SearchOrderType.OLD) {
if (orderBy === SearchOrderType.Old) {
data.sort((a: UISearchResultData, b: UISearchResultData) => a.at - b.at)
}
if (orderBy === SearchOrderType.RELEVANT) {
if (orderBy === SearchOrderType.Relevant) {
data.sort(
(a: UISearchResultData, b: UISearchResultData) => b.score - a.score,
)
Expand Down
6 changes: 3 additions & 3 deletions types/search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export type SearchFilter = {
}

export enum SearchOrderType {
NEW = 'new',
OLD = 'old',
RELEVANT = 'relevant',
New = 'new',
Old = 'old',
Relevant = 'relevant',
}

export type SearchParam = {
Expand Down

0 comments on commit cd9bb71

Please sign in to comment.