Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/routes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,15 @@ async def dashboard(request: Request, db: AsyncSession = Depends(get_db)):
session.pop("current_preview_url_hash", None)

# Get user's published papers with subject names (exclude html_content for performance)
# Only show the latest version of each scroll series
published_papers = await db.execute(
select(Scroll, Subject.name.label("subject_name"))
.join(Subject)
.where(Scroll.user_id == current_user.id, Scroll.status == "published")
.where(
Scroll.user_id == current_user.id,
Scroll.status == "published",
_latest_version_filter(),
)
.options(
load_only(
Scroll.title,
Expand All @@ -553,6 +558,7 @@ async def dashboard(request: Request, db: AsyncSession = Depends(get_db)):
Scroll.doi_status,
Scroll.slug,
Scroll.publication_year,
Scroll.scroll_series_id,
)
)
.order_by(Scroll.created_at.desc())
Expand Down
69 changes: 56 additions & 13 deletions app/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,27 @@ <h2>Your Scrolls ({{ papers|length }})</h2>
{% for paper_row in papers %}
{% set paper = paper_row[0] %}
{% set subject_name = paper_row[1] %}
{{ scroll_card(
paper.title,
paper.authors,
paper.abstract,
paper.keywords,
subject_name,
"recently",
"v" + paper.version|string,
paper.url_hash,
doi=paper.doi,
doi_status=paper.doi_status,
canonical_url=paper.canonical_url
) }}
<div class="scroll-card-wrapper">
{{ scroll_card(
paper.title,
paper.authors,
paper.abstract,
paper.keywords,
subject_name,
"recently",
"v" + paper.version|string,
paper.url_hash,
doi=paper.doi,
doi_status=paper.doi_status,
canonical_url=paper.canonical_url
) }}
<div class="scroll-card-actions">
<a href="/upload?revises={{ paper.url_hash }}" class="btn btn-secondary btn-sm">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/></svg>
Upload New Version
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
Expand Down Expand Up @@ -555,6 +563,41 @@ <h3>Delete Account</h3>
padding: var(--space-sm) var(--space-md);
font-size: var(--text-sm);
}

.scroll-card-wrapper {
border: 1px solid var(--gray-lightest);
border-radius: var(--border-radius);
overflow: hidden;
}

.scroll-card-wrapper .scroll.preview {
border: none;
border-radius: 0;
}

.scroll-card-actions {
padding: 0.5rem 1rem;
border-top: 1px solid var(--gray-lightest);
background: var(--gray-bg);
display: flex;
justify-content: flex-end;
}

.scroll-card-actions .btn {
display: inline-flex;
align-items: center;
gap: 0.375rem;
}

@media (max-width: 768px) {
.scroll-card-actions {
justify-content: center;
}
.scroll-card-actions .btn {
width: 100%;
justify-content: center;
}
}
</style>

<script>
Expand Down
15 changes: 14 additions & 1 deletion app/templates/partials/upload_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
{% from "components/button.html" import button %}

<div class="upload-header" id="upload-header">
{% if revising_scroll %}
<h1>Upload New Version</h1>
{% else %}
<h1>Upload New Scroll</h1>
<p>Share your interactive, web-native research with the world</p>
{% endif %}
</div>

{% if revising_scroll %}
<div class="revision-context">
<div class="revision-context-label">Updating:</div>
<div class="revision-context-title">{{ revising_scroll.title }}</div>
<div class="revision-context-meta">Currently at v{{ revising_scroll.version }}{% if revising_scroll.published_at %} &middot; Published {{ revising_scroll.published_at.strftime('%B %-d, %Y') }}{% endif %}</div>
<div class="revision-context-next">This will become v{{ revising_scroll.version + 1 }}.</div>
</div>
{% endif %}

{% if current_drafts and not form_data and not session.get('dismissed_draft_banner') %}
<div class="drafts-banner">
<div class="drafts-banner-content">
Expand Down Expand Up @@ -130,7 +143,7 @@ <h1>Upload New Scroll</h1>
{{ form_checkbox("confirm_rights", "I confirm that I have the right to publish this content and that it does not violate any policies or third-party rights", required=true, checked=form_data.confirm_rights if form_data else false) }}

<div class="form-actions">
{{ button("Preview Scroll", type="submit", variant="primary", name="action", value="publish", loading_text="Uploading...") }}
{{ button("Preview New Version" if revising_scroll else "Preview Scroll", type="submit", variant="primary", name="action", value="publish", loading_text="Uploading...") }}
</div>
</form>

Expand Down
37 changes: 37 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,43 @@ mark {
font-family: var(--font-serif);
}

.revision-context {
background: var(--gray-bg);
border: 1px solid var(--gray-lightest);
border-left: 3px solid var(--red);
border-radius: var(--border-radius);
padding: var(--space-lg);
margin-top: var(--space-md);
margin-bottom: var(--space-lg);
}

.revision-context-label {
font-size: var(--text-sm);
color: var(--gray);
font-weight: 500;
margin-bottom: var(--space-xs);
}

.revision-context-title {
font-family: var(--font-serif);
font-size: var(--text-lg);
font-weight: 600;
color: var(--black);
margin-bottom: var(--space-sm);
}

.revision-context-meta {
font-size: var(--text-sm);
color: var(--gray);
}

.revision-context-next {
font-size: var(--text-sm);
color: var(--gray-dark);
font-weight: 500;
margin-top: var(--space-sm);
}

.form-group {
margin-bottom: 2rem;
}
Expand Down
Loading
Loading