mirror of
https://github.com/urbit/shrub.git
synced 2024-11-27 18:34:48 +03:00
publish: sidebar defensive checks and style fixes
This commit is contained in:
parent
bc4dd57896
commit
6b06367cc4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,14 +17,15 @@ export class NotebookItem extends Component {
|
||||
<Link
|
||||
to={"/~publish/notebook/" + props.path}>
|
||||
<div className={"w-100 v-mid f9 pl4 bb " + selectedClass}>
|
||||
<p className="f9 pt1">{props.title}</p>
|
||||
<p className="f9 mono gray2">by {props.author}</p>
|
||||
<p className="f9 pb1">
|
||||
{postCount}
|
||||
<span className="green2 ml3">
|
||||
{unread}
|
||||
</span>
|
||||
</p></div>
|
||||
<p className="f9 pt1">{props.title}</p>
|
||||
<p className="f9 mono gray2">by {props.author}</p>
|
||||
<p className="f9 pb1">
|
||||
{postCount}
|
||||
<span className="green2 ml3">
|
||||
{unread}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
@ -36,40 +36,52 @@ export class Sidebar extends Component {
|
||||
case "oldest":
|
||||
notebooks = new Map(
|
||||
[...notebooks.entries()].sort(
|
||||
(a, b) => a[1]["date-created"] - b[1]["date-created"]
|
||||
(a, b) => {
|
||||
if ((a[1]) && (b[1])) {
|
||||
return a[1]["date-created"] - b[1]["date-created"]
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
break;
|
||||
case "newest":
|
||||
notebooks = new Map(
|
||||
[...notebooks.entries()].sort(
|
||||
(a, b) => b[1]["date-created"] - a[1]["date-created"]
|
||||
(a, b) => {
|
||||
if ((a[1]) && (b[1])) {
|
||||
return b[1]["date-created"] - a[1]["date-created"]
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
break;
|
||||
case "alphabetical":
|
||||
notebooks = new Map(
|
||||
[...notebooks.entries()].sort((a, b) => {
|
||||
if (a[1]["title"].toLowerCase() < b[1]["title"].toLowerCase()) {
|
||||
return -1;
|
||||
if ((a[1]) && (b[1])) {
|
||||
if (a[1]["title"].toLowerCase() < b[1]["title"].toLowerCase()) {
|
||||
return -1;
|
||||
}
|
||||
if (a[1]["title"].toLowerCase() > b[1]["title"].toLowerCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (a[1]["title"].toLowerCase() > b[1]["title"].toLowerCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
);
|
||||
break;
|
||||
case "reverseAlphabetical":
|
||||
notebooks = new Map(
|
||||
[...notebooks.entries()].sort((a, b) => {
|
||||
if (a[1]["title"].toLowerCase() > b[1]["title"].toLowerCase()) {
|
||||
return -1;
|
||||
if ((a[1]) && (b[1])) {
|
||||
if (a[1]["title"].toLowerCase() > b[1]["title"].toLowerCase()) {
|
||||
return -1;
|
||||
}
|
||||
if (a[1]["title"].toLowerCase() < b[1]["title"].toLowerCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (a[1]["title"].toLowerCase() < b[1]["title"].toLowerCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user