diff --git a/models/import.js b/models/import.js
index 0b8dacf..5cbcb34 100644
--- a/models/import.js
+++ b/models/import.js
@@ -8,7 +8,7 @@ module.exports = (event, state) => {
case '/legislation/:shortId/import':
case '/nominations/:shortId/import':
case '/:username/:shortId/import':
- if (!state.user || !state.user.is_admin) return [{ ...state, loading: { page: true } }, redirect('/')]
+ if (!state.user) return [{ ...state, loading: { page: true } }, redirect('/join')]
return [state]
default:
return [state]
diff --git a/views/import-author-form-new.js b/views/import-author-form-new.js
new file mode 100644
index 0000000..99d984f
--- /dev/null
+++ b/views/import-author-form-new.js
@@ -0,0 +1,176 @@
+const { APP_NAME } = process.env
+const { avatarURL, handleForm, html } = require('../helpers')
+const { icon } = require('@fortawesome/fontawesome-svg-core')
+const { faUser } = require('@fortawesome/free-solid-svg-icons/faUser')
+const { faLink } = require('@fortawesome/free-solid-svg-icons/faLink')
+const { faTwitter } = require('@fortawesome/free-brands-svg-icons/faTwitter')
+const { faExclamationTriangle } = require('@fortawesome/free-solid-svg-icons/faExclamationTriangle')
+const { faEdit } = require('@fortawesome/free-solid-svg-icons/faEdit')
+const { faEnvelope } = require('@fortawesome/free-solid-svg-icons/faEnvelope')
+const { faPlus } = require('@fortawesome/free-solid-svg-icons/faPlus')
+
+module.exports = (state, dispatch) => {
+ const { location } = state
+ const tab = location.query.tab || 'search'
+ const path = location.path
+
+ return html`
+
+
+ ${tab === 'email' ? addAuthorByEmailForm(state, dispatch) : []}
+ ${tab === 'twitter' ? addAuthorByTwitterForm() : []}
+ ${tab === 'search' ? addAuthorBySearchForm(state, dispatch) : []}
+
+ `
+}
+
+const addAuthorByEmailForm = (state) => {
+ const { error } = state
+
+ return html`
+
+
+
+
+
+ ${icon(faUser)}
+
+
+
+
+
+ ${icon(faLink)}
+
+
+
+
+
+ ${error && error.email
+ ? html`
${icon(faExclamationTriangle)}`
+ : html`
${icon(faEnvelope)}`
+ }
+ ${error && error.email ? html`
${error.message}
` : ''}
+
+
+
+
+ They'll be sent a notification email.
+ `
+}
+
+const addAuthorByTwitterForm = () => {
+ return html`
+
+
+
+ ${icon(faTwitter)}
+
+
+ They'll be sent an invitation tweet.
+ `
+}
+
+const addAuthorBySearchForm = (state, dispatch) => {
+ const { error, loading, cookies, authorSearchResults = [], authorSearchTerms } = state
+
+ return html`
+
+
+
+
+ ${authorSearchTerms && !authorSearchResults.length ? html`
No results for "${authorSearchTerms}"
` : ''}
+ ${authorSearchResults.map(result => searchResult(cookies, result, dispatch))}
+ ${authorSearchTerms ? html`
Can't find who you're looking for?
Add them by email or Twitter username.
` : ''}
+
+ `
+}
+
+const searchResult = (cookies, result, dispatch) => {
+ const { first_name, id, last_name, username, twitter_username } = result
+
+ return html`
+
+ `
+}
+
+const searchResultAdd = (id, username, twitter_username, dispatch) => {
+ return html`
+
+ `
+}
+
+const searchResultAdded = ({ id }) => {
+ return html`
+
+ `
+}
diff --git a/views/import-vote-page.js b/views/import-vote-page.js
index cc1a3ab..baa17ab 100644
--- a/views/import-vote-page.js
+++ b/views/import-vote-page.js
@@ -1,17 +1,23 @@
const { handleForm, html } = require('../helpers')
-module.exports = ({ error, location, user }, dispatch) => {
+module.exports = (state, dispatch) => {
+ const { error, location, user } = state
return html`
-
+
- ${!user || !user.is_admin ? html`
You do not have permission to import votes.
` : ''}
+ ${!user ? html`
Login to import comments.
` : html`
Once imported & approved, it will be displayed alongside other comments.
`}
-
-
-
-
- ${!is_public && ownVote
- ? 'You'
- : vote.user
- ? vote.user.public_profile
- ? html`${vote.user.first_name} ${vote.user.last_name}`
- : html`${vote.user.first_name} ${vote.user.last_name}`
- : '[private]'}
-
- ${html`
${delegate_name && delegate_rank !== -1 ? 'inherited' : 'voted'} ${position}${delegate_rank !== -1 && delegate_name ? ` vote from ${delegate_name}` : ''}${delegate_rank === -1 && vote_power > 1 && is_public ? html` on behalf of ${vote_power} people` : ''}${is_public ? '' : ' privately'}`}
- ${source_url ? html`
[source]` : ''}
+
+
+
+
+ ${!is_public && ownVote
+ ? 'You'
+ : vote.user
+ ? vote.user.public_profile
+ ? html`${vote.user.first_name} ${vote.user.last_name}`
+ : html`${vote.user.first_name} ${vote.user.last_name}`
+ : '[private]'}
+
+ ${html`
${delegate_name && delegate_rank !== -1 ? 'inherited' : 'voted'} ${position}${delegate_rank !== -1 && delegate_name ? ` vote from ${delegate_name}` : ''}${delegate_rank === -1 && vote_power > 1 && is_public ? html` on behalf of ${vote_power} people` : ''}${is_public ? '' : ' privately'}`}
+ ${source_url ? html`
[source]` : ''}
+
+
+ ${user && user.is_admin ?
+ html`
+
+
+ `
+ : ``}
${displayTitle ? html`` : ''}
${commentContent(key, vote, parent, dispatch)}