myYouTube/frontend/src/App.css
vrubelroman 3089202316 Add delete-downloaded-video and real YouTube unsubscribe
Delete local copy:
- MeTubeClient.delete_download() -> POST /delete {ids, where: "done"}
- Only ever acts on a job our own app tracked (metube_job_id we stored from
  its own 'completed' event), never a pre-existing MeTube file
- New "deleted" terminal status; DELETE /api/videos/{id}/download
- Frontend: delete button next to "На сервере" badge, confirm dialog

Unsubscribe (deliberate deviation from the original TZ's MVP exclusion of
subscription management, per explicit user request after being shown the
tradeoff):
- OAuth scope widened from youtube.readonly to full youtube (read/write) --
  existing stored tokens only cover the old scope, so unsubscribing needs a
  fresh reconnect; reads keep working unchanged on the old token meanwhile
- channels.youtube_subscription_id (distinct from the channel id; that's
  what subscriptions.delete actually keys on) captured during subscriptions
  sync
- YouTubeInsufficientScope raised on 401/403 "insufficient authentication
  scopes" and surfaced as a clear 403 asking the user to reconnect, rather
  than a generic API error
- POST /api/channels/{id}/unsubscribe calls subscriptions.delete and marks
  the channel unsubscribed locally on success
- Frontend: "Отписаться" button on ChannelCard with confirm dialog

10 new backend tests (73 total).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 19:47:35 +00:00

456 lines
6.5 KiB
CSS

.app {
max-width: 960px;
margin: 0 auto;
padding: 24px;
text-align: left;
}
.error {
color: #d33;
}
.connect-screen {
text-align: center;
padding-top: 80px;
}
.connect-screen button {
font-size: 16px;
padding: 10px 24px;
cursor: pointer;
}
.channels-screen header,
.feed-screen header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 16px;
}
.channels-screen .actions,
.feed-screen .actions {
display: flex;
gap: 8px;
align-items: center;
}
.channels-screen .actions a,
.feed-screen .actions a {
align-self: center;
}
.channels-screen input[type='text'] {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
}
.layout {
display: flex;
gap: 20px;
align-items: flex-start;
}
.category-nav {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 160px;
flex-shrink: 0;
}
.category-nav button {
text-align: left;
padding: 6px 10px;
border: none;
background: transparent;
cursor: pointer;
border-radius: 6px;
}
.category-nav button.active {
background: var(--accent-bg, #eee);
font-weight: 600;
}
.content {
flex: 1;
min-width: 0;
}
.channel-list {
list-style: none;
padding: 0;
margin: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 12px;
}
.channel-card {
display: flex;
align-items: flex-start;
gap: 10px;
border: 1px solid #ddd;
border-radius: 8px;
padding: 8px;
}
.channel-card img {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
}
.channel-info {
flex: 1;
min-width: 0;
}
.channel-title {
font-weight: 500;
color: inherit;
text-decoration: none;
display: block;
}
.channel-title:hover {
text-decoration: underline;
}
.badge {
font-size: 12px;
color: #999;
}
.unsubscribe-button {
font-size: 12px;
padding: 2px 8px;
margin-left: 8px;
border: 1px solid #ccc;
border-radius: 10px;
background: transparent;
cursor: pointer;
}
.unsubscribe-error {
font-size: 12px;
margin-top: 4px;
}
.channel-categories {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-top: 6px;
align-items: center;
}
.chip {
font-size: 12px;
background: #eee;
border-radius: 12px;
padding: 2px 8px;
}
.chip-edit {
font-size: 12px;
padding: 2px 8px;
border-radius: 12px;
border: 1px dashed #aaa;
background: transparent;
cursor: pointer;
}
.category-popover-wrapper {
position: relative;
display: inline-block;
}
.category-popover {
position: absolute;
top: calc(100% + 4px);
left: 0;
z-index: 10;
background: #fff;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 8px;
display: flex;
flex-direction: column;
gap: 4px;
font-size: 13px;
min-width: 160px;
max-height: 240px;
overflow-y: auto;
}
.category-popover-empty {
color: #999;
white-space: nowrap;
}
.category-checkbox {
display: flex;
align-items: center;
gap: 6px;
}
.categories-screen {
max-width: 600px;
}
.back-link {
display: inline-block;
margin-bottom: 8px;
}
.category-form {
display: flex;
gap: 8px;
margin-bottom: 16px;
}
.category-form input {
flex: 1;
padding: 8px;
}
.category-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.category-row {
display: flex;
align-items: center;
gap: 10px;
border: 1px solid #ddd;
border-radius: 8px;
padding: 8px 12px;
}
.reorder-buttons {
display: flex;
flex-direction: column;
}
.reorder-buttons button {
border: none;
background: transparent;
cursor: pointer;
line-height: 1;
}
.category-name {
flex: 1;
font-weight: 500;
}
.category-count {
font-size: 12px;
color: #999;
}
.category-edit-form {
flex: 1;
display: flex;
gap: 8px;
}
.video-grid {
list-style: none;
padding: 0;
margin: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 16px;
}
.video-card {
display: flex;
flex-direction: column;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
}
.video-thumbnail {
position: relative;
display: block;
aspect-ratio: 16 / 9;
background: #eee;
}
.video-thumbnail img,
.video-thumbnail-placeholder {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.video-thumbnail-placeholder {
background: #ddd;
}
.duration-badge {
position: absolute;
right: 6px;
bottom: 6px;
background: rgba(0, 0, 0, 0.75);
color: #fff;
font-size: 12px;
padding: 1px 5px;
border-radius: 3px;
}
.video-info {
padding: 8px 10px;
}
.video-title {
font-weight: 500;
font-size: 14px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
color: inherit;
text-decoration: none;
}
.video-title:hover {
text-decoration: underline;
}
.video-meta {
font-size: 12px;
color: #999;
margin-top: 4px;
}
.video-actions {
margin-top: 8px;
}
.button-link {
display: inline-block;
font-size: 13px;
padding: 4px 10px;
border: 1px solid #ccc;
border-radius: 6px;
text-decoration: none;
color: inherit;
}
.load-more {
display: block;
margin: 16px auto 0;
padding: 8px 20px;
cursor: pointer;
}
.video-page {
max-width: 900px;
}
.player-wrapper {
position: relative;
width: 100%;
aspect-ratio: 16 / 9;
background: #000;
border-radius: 8px;
overflow: hidden;
margin-bottom: 16px;
}
.player-wrapper iframe,
.player-wrapper video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
background: #000;
}
.download-badge {
display: inline-block;
font-size: 12px;
padding: 3px 8px;
border-radius: 10px;
background: #eee;
}
.download-badge.completed {
background: #dcf5df;
color: #1a7f2e;
}
.download-badge.error {
background: #fbdcdc;
color: #a3221f;
}
.download-error,
.download-inline-actions {
display: inline-flex;
align-items: center;
gap: 6px;
}
.video-actions button,
.video-page-meta button {
font-size: 13px;
padding: 4px 10px;
border: 1px solid #ccc;
border-radius: 6px;
background: transparent;
cursor: pointer;
}
.video-page-title {
font-size: 20px;
margin: 0 0 8px;
}
.video-page-meta {
color: #999;
font-size: 14px;
margin-bottom: 4px;
}
.video-page-meta a {
color: inherit;
}
.video-page-source {
font-size: 13px;
color: #999;
margin-bottom: 8px;
}
.video-page-categories {
display: flex;
gap: 6px;
margin-bottom: 16px;
}
.video-page-description {
white-space: pre-wrap;
font-size: 14px;
line-height: 1.5;
border-top: 1px solid #ddd;
padding-top: 16px;
}