Skip to content

Commit

Permalink
post-PR fixes: formatting && m
Browse files Browse the repository at this point in the history
  • Loading branch information
belyaev-mikhail committed Dec 3, 2020
1 parent 9daf712 commit 341f59d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
7 changes: 3 additions & 4 deletions kotoed-js/src/main/ts/code/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ export function loadLostFound(payload: SubmissionPayload) {
}

// Lower numbers are displayed first
const fileTypeDisplayOrder = Map<FileType, number>({"directory": 1, "file": 2})
const fileTypeDisplayOrder = {directory: 1, file: 2}
const naturalSorter = natsort()
const typeSorter = (a: File, b: File) => fileTypeDisplayOrder[a.type] - fileTypeDisplayOrder[b.type]

export function fetchRootDirIfNeeded(payload: SubmissionPayload) {
return (dispatch: Dispatch<CodeReviewState>, getState: () => CodeReviewState) => {
Expand All @@ -223,9 +225,6 @@ export function fetchRootDirIfNeeded(payload: SubmissionPayload) {
}));

return fetchRootDir(payload.submissionId).then((root) => {
const naturalSorter = natsort()
const typeSorter = (a: File, b: File) =>
fileTypeDisplayOrder.get(a.type) - fileTypeDisplayOrder.get(b.type)
const recursiveSorter = (node: File) => {
if (node.children == null) {
return
Expand Down
34 changes: 16 additions & 18 deletions kotoed-js/src/main/ts/projects/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,14 @@ class ProjectsSearch extends React.Component<{}, ProjectSearchState> {
tagCloug = (cb: SearchCallback) => {
return this.state.tags.length !== 0 && <Row>
<Col xs={12} sm={12} md={12} lg={12}>
{intersperse<JSX.Element | string>(this.state.tags.map(tag => <TagComponent key={tag.id} tag={tag}
removable={false}
onClick={() => {
const searchState = cb();
// XXX: we can do better
// XXX: also it's a copy-paste from ProjectComponent
if (!searchState.oldKey.includes(tag.name)) {
searchState.toggleSearch(searchState.oldKey + " " + tag.name)
}
}}/>), " ")}
{intersperse<JSX.Element | string>(this.state.tags.map(tag => <TagComponent key={tag.id} tag={tag} removable={false} onClick={() => {
const searchState = cb();
// XXX: we can do better
// XXX: also it's a copy-paste from ProjectComponent
if(!searchState.oldKey.includes(tag.name)) {
searchState.toggleSearch(searchState.oldKey + " " + tag.name)
}
}}/>), " ")}
</Col>
</Row>;
};
Expand Down Expand Up @@ -269,16 +267,16 @@ class ProjectsSearch extends React.Component<{}, ProjectSearchState> {
return (
<Table striped bordered condensed hover responsive>
<thead>
<tr>
<th className="col-md-1">Id</th>
<th className="col-md-2">Name</th>
<th className="col-md-3">Author</th>
<th className="col-md-1">Repo</th>
<th className="col-md-5">Open submissions</th>
</tr>
<tr>
<th className="col-md-1">Id</th>
<th className="col-md-2">Name</th>
<th className="col-md-3">Author</th>
<th className="col-md-1">Repo</th>
<th className="col-md-5">Open submissions</th>
</tr>
</thead>
<tbody>
{children}
{children}
</tbody>
</Table>)
};
Expand Down

0 comments on commit 341f59d

Please sign in to comment.