'use strict'; const UTag = props => { const tag_name = props.tag; const turl = "/?rank=tags&tags=" + tag_name; return (
{tag_name}
) } const Paper = props => { const p = props.paper; const adder = () => fetch("/add/" + p.id + "/" + prompt("tag to add to this paper:")) .then(response => console.log(response.text())); const subber = () => fetch("/sub/" + p.id + "/" + prompt("tag to subtract from this paper:")) .then(response => console.log(response.text())); const utags = p.utags.map((utxt, ix) => ); const similar_url = "/?rank=pid&pid=" + p.id; const inspect_url = "/inspect?pid=" + p.id; // if the user is logged in then we can show add/sub buttons let utag_controls = null; if(user) { utag_controls = (
+
-
{utags}
) } return (
{p.weight.toFixed(2)}
{p.authors}
{p.time}
{p.tags}
{utag_controls}
{p.summary}
) } const PaperList = props => { const lst = props.papers; const plst = lst.map((jpaper, ix) => ); return (
{plst}
) } const Tag = props => { const t = props.tag; const turl = "/?rank=tags&tags=" + t.name; const tag_class = 'rel_utag' + (t.name === 'all' ? ' rel_utag_all' : ''); return ( ) } const TagList = props => { const lst = props.tags; const tlst = lst.map((jtag, ix) => ); const deleter = () => fetch("/del/" + prompt("delete tag name:")) .then(response => console.log(response.text())); return (
-
{tlst}
) } // render papers into #wrap ReactDOM.render(, document.getElementById('wrap')); // render tags into #tagwrap, if it exists let tagwrap_elt = document.getElementById('tagwrap'); if (tagwrap_elt) { ReactDOM.render(, tagwrap_elt); }