Skip to content

Commit 8f7398b

Browse files
authored
Merge pull request #88 from epochtalk/css-layout-update
Css layout update
2 parents e4fc4f8 + 1d910d7 commit 8f7398b

File tree

8 files changed

+115
-75
lines changed

8 files changed

+115
-75
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ main {
106106
#public-content {
107107
@include base-layout-width;
108108
@include grid-base-layout;
109-
@include grid-columns-base;
110109
// margin-top: $header-bottom-margin;
111110
grid-template-areas:
112111
"header header"
113112
"main main"
114113
"sidebar sidebar";
115114
grid-gap: 2rem;
115+
column-gap: 0;
116116
row-gap: 0;
117117
margin-bottom: 2rem;
118118

src/assets/scss/_global-components.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,6 @@ input[disabled].toggle-switch:checked + label:after { background-color: lighten(
979979
color: $sub-header-font-color;
980980
margin: 1.5rem 0;
981981
max-height: calc(100vh - 16rem);
982-
min-height: 200px;
983982
overflow-x: hidden;
984983
overflow-y: auto;
985984
button { margin: 0.5rem 0 0; width: 100%; }

src/components/polls/PollViewer.vue

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<template>
22
<div class="polls" id="poll-view" v-if="poll">
33
<!-- Poll Header -->
4-
<div class="poll-title">
4+
<div class="poll-title collapse-section" @click="togglePollsCollapsed()">
55
<span class="poll-title-text">
6+
<a :class="{ 'is-open': !options.polls_collapsed, 'is-closed': options.polls_collapsed }">
7+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 39.84 22.63" class="icon__caretDown">
8+
<title></title>
9+
<g id="Layer_2" data-name="Layer 2">
10+
<polyline class="icon" points="37.92 1.92 19.92 19.92 1.92 1.92" />
11+
</g>
12+
</svg>
13+
</a>
614
Poll
715
<span class="is_locked" v-if="pollCopy.locked">(Locked)</span>
816
</span>
9-
<div class="poll-controls">
17+
<div v-if="!options.polls_collapsed" class="poll-controls">
1018
<!-- Poll Controls -->
1119
<div class="poll-control" v-if="canLock()">
1220
<input id="lockPoll" class="icon" type="checkbox" v-model="pollCopy.locked">
@@ -32,7 +40,7 @@
3240
</div>
3341

3442
<!-- Poll Edit -->
35-
<div class="poll-edit" v-if="canEdit()" :class="{'showing': editPoll, 'hidden': !editPoll}">
43+
<div class="poll-edit" v-if="canEdit() && !options.polls_collapsed" :class="{'showing': editPoll, 'hidden': !editPoll}">
3644
<div class="slide-wrapper">
3745
<div class="poll-edit-container">
3846
<h5 class="panelTitle">Edit Poll Options:</h5>
@@ -71,7 +79,7 @@
7179
</div>
7280
</div>
7381

74-
<div class="poll-body">
82+
<div v-if="!options.polls_collapsed" class="poll-body">
7583
<div class="poll-header">
7684
<!-- Poll Details -->
7785
<div class="poll-header-main">
@@ -117,7 +125,7 @@
117125
</div>
118126
</div>
119127
</div>
120-
<div class="actionsBar">
128+
<div v-if="!options.polls_collapsed" class="actionsBar">
121129
<button @click="vote()" :disabled="pollAnswers.length === 0" v-if="canVote()">Vote</button>
122130
<button v-if="canRemoveVote()" @click="removeVote()" class="secondary">Remove Vote</button>
123131
</div>
@@ -288,6 +296,11 @@ export default {
288296
console.log('scrollPollView')
289297
// $('#poll-view').animate({ scrollTop: 0 }, 250)
290298
}
299+
300+
const togglePollsCollapsed = () => {
301+
v.options.polls_collapsed = !v.options.polls_collapsed
302+
}
303+
291304
/* Internal Data */
292305
const $auth = inject(AuthStore)
293306
const $alertStore = inject('$alertStore')
@@ -303,7 +316,8 @@ export default {
303316
display_mode: props.poll.display_mode,
304317
// used in view to track date and time from input field
305318
expiration_date: props.poll.expiration ? dayjs(props.poll.expiration).format('YYYY-MM-DD') : undefined,
306-
expiration_time: props.poll.expiration ? dayjs(props.poll.expiration).format('HH:mm') : undefined
319+
expiration_time: props.poll.expiration ? dayjs(props.poll.expiration).format('HH:mm') : undefined,
320+
polls_collapsed: false
307321
},
308322
editPoll: false,
309323
pollAnswers: [],
@@ -334,7 +348,8 @@ export default {
334348
updateLockPoll,
335349
calcExpiration,
336350
scrollPollView,
337-
humanDate
351+
humanDate,
352+
togglePollsCollapsed
338353
}
339354
}
340355
}
@@ -351,4 +366,34 @@ export default {
351366
max-height: 0rem;
352367
}
353368
}
369+
370+
.collapse-section {
371+
@include no-select;
372+
cursor: pointer;
373+
a { margin-left: -0.5rem; }
374+
.title { display: inline-block; margin-left: .5rem; }
375+
.is-open {
376+
.icon__caretDown {
377+
transform: rotateZ(0deg);
378+
transition: all ease-in-out 150ms;
379+
}
380+
}
381+
.is-closed {
382+
.icon__caretDown {
383+
transform: rotateZ(-90deg);
384+
transition: all ease-in-out 150ms;
385+
}
386+
}
387+
.icon__caretDown {
388+
margin-bottom: 3px;
389+
width: 8px;
390+
polyline {
391+
fill: none;
392+
stroke: $secondary-font-color;
393+
stroke-linecap: round;
394+
stroke-miterlimit: 10;
395+
stroke-width: 7px;
396+
}
397+
}
398+
}
354399
</style>

src/components/users/UserPosts.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ export default {
253253
}
254254
&.closed {
255255
width: 100%;
256+
@include break-mobile-sm {
257+
max-height: 3rem;
258+
}
256259
max-height: 2.5rem;
257260
white-space: pre-wrap;
258261
overflow: hidden;

src/views/Boards.vue

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,32 @@
5151
</div>
5252
</div>
5353

54-
<div class="board-secondary">
55-
<!-- Board Posts and Threads -->
56-
<div class="view-count">
57-
<p class="view-count-posts">
58-
<span class="view-count-number">{{board.total_post_count}}</span>
59-
<span class="label"> posts, </span>
60-
</p>
61-
<p class="view-count-threads">
62-
<span class="view-count-number">{{board.total_thread_count}}</span>
63-
<span class="label"> threads</span>
64-
</p>
65-
</div>
54+
<!-- Board Posts and Threads -->
55+
<div class="view-count">
56+
<p class="view-count-posts">
57+
<span class="view-count-number">{{board.total_post_count.toLocaleString()}}</span>
58+
<span class="label"> Posts </span>
59+
</p>
60+
<p class="view-count-threads">
61+
<span class="view-count-number">{{board.total_thread_count.toLocaleString()}}</span>
62+
<span class="label"> Threads</span>
63+
</p>
64+
</div>
6665

67-
<!-- Board Last Post By -->
68-
<div class="last-post">
69-
<div v-if="board.last_post_username">
70-
<span v-if="board.user_deleted || board.post_deleted">deleted</span>
71-
<img v-if="!board.user_deleted && !board.post_deleted" class="avatar-small" :class="defaultAvatarShape" :src="board.last_post_avatar || defaultAvatar" @error="$event.target.src=defaultAvatar" />
72-
<router-link v-if="!board.user_deleted && !board.post_deleted" :to="{ path: '/profile/' + board.last_post_username.toLowerCase(), query: { id: board.last_post_user_id }}">{{board.last_post_username}}</router-link> posted in
73-
<span v-if="board.last_thread_title">
74-
<router-link :to="{ name: 'Posts', params: { threadSlug: board.last_thread_slug }, query: { start: board.last_post_position} }">
75-
<span v-html="board.last_thread_title"></span>
76-
</router-link> on
77-
</span>
78-
<span vi-if="board.last_post_created_at">
79-
<span>{{humanDate(board.last_post_created_at)}}</span>
80-
</span>
81-
</div>
66+
<!-- Board Last Post By -->
67+
<div class="last-post">
68+
<div v-if="board.last_post_username">
69+
<span v-if="board.user_deleted || board.post_deleted">deleted</span>
70+
<img v-if="!board.user_deleted && !board.post_deleted" class="avatar-small" :class="defaultAvatarShape" :src="board.last_post_avatar || defaultAvatar" @error="$event.target.src=defaultAvatar" />
71+
<router-link v-if="!board.user_deleted && !board.post_deleted" :to="{ path: '/profile/' + board.last_post_username.toLowerCase(), query: { id: board.last_post_user_id }}">{{board.last_post_username}}</router-link> posted in
72+
<span v-if="board.last_thread_title">
73+
<router-link :to="{ name: 'Posts', params: { threadSlug: board.last_thread_slug }, query: { start: board.last_post_position} }">
74+
<span v-html="truncate(decode(board.last_thread_title), 25)"></span>
75+
</router-link>
76+
</span>
77+
<span vi-if="board.last_post_created_at">
78+
<br />on <span>{{humanDate(board.last_post_created_at)}}</span>
79+
</span>
8280
</div>
8381
</div>
8482
</div>
@@ -96,6 +94,8 @@
9694
import useSWRV from 'swrv'
9795
import { mutate } from 'swrv'
9896
import humanDate from '@/composables/filters/humanDate'
97+
import decode from '@/composables/filters/decode'
98+
import truncate from '@/composables/filters/truncate'
9999
import RecentThreads from '@/components/threads/RecentThreads.vue'
100100
import LoginModal from '@/components/modals/auth/Login.vue'
101101
import RegisterModal from '@/components/modals/auth/Register.vue'
@@ -160,7 +160,7 @@ export default {
160160
watch(() => v.loggedIn, () => v.boardData.mutate(getBoards)) // Update boards on login
161161
watch(() => v.boardData.error, err => err ? $alertStore.error(err) : null) // Handle errors
162162
163-
return { ...toRefs(v), generateCatId, toggleCategory, humanDate }
163+
return { ...toRefs(v), generateCatId, toggleCategory, humanDate, decode, truncate }
164164
}
165165
}
166166
</script>
@@ -236,7 +236,8 @@ img.avatar-small {
236236
.board {
237237
display: flex;
238238
flex-direction: row;
239-
padding: 0 0 1rem 0;
239+
padding: 0.5rem 0;
240+
border-bottom: 1px solid rgba(215, 215, 215, 0.35);
240241
@include break-mobile-sm { flex-direction: column; }
241242
.info {
242243
flex: 2 0 0;
@@ -277,15 +278,11 @@ img.avatar-small {
277278
}
278279
}
279280
280-
.board-secondary {
281-
display: flex;
282-
flex: 1;
283-
flex-direction: column;
284-
}
285-
286281
.view-count {
282+
padding-top: 0.5rem;
283+
flex: 0 1 10%;
284+
margin-right: 1rem;
287285
@include info-text;
288-
flex: 0 0 50%;
289286
290287
&-posts,
291288
&-threads {
@@ -307,15 +304,16 @@ img.avatar-small {
307304
}
308305
309306
.last-post {
307+
padding-top: 0.5rem;
310308
@include info-text;
311-
flex: 2;
312309
word-break: break-word;
310+
flex: 0.5 1 120px;
311+
@include break-min-desktop {
312+
text-align: right;
313+
}
313314
}
314315
315-
@include break-max-desktop {
316-
.view-count {
317-
flex: 0 0 auto;
318-
}
316+
@include break-mobile-sm {
319317
.view-count-posts,
320318
.view-count-threads {
321319
display: inline;
@@ -325,18 +323,6 @@ img.avatar-small {
325323
text-align: left;
326324
}
327325
}
328-
329-
@include break-min-desktop {
330-
.info {
331-
flex: 2;
332-
}
333-
.board-secondary {
334-
flex-direction: row;
335-
.view-count {
336-
padding-right: 2rem;
337-
}
338-
}
339-
}
340326
}
341327
342328
@include break-mobile-sm {

src/views/Posts.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
</div>
100100

101101
<!-- <pagination page-count="PostsParentCtrl.pageCount" page="PostsParentCtrl.page"></pagination> -->
102+
103+
<!-- Poll Viewer -->
104+
<poll-viewer v-if="postData.data.thread?.poll" :poll="postData.data.thread.poll" :thread="postData.data.thread" :user-priority="postData.data.posts[0].user.priority" :reset="resetPoll" :banned-from-board="bannedFromBoard"></poll-viewer>
102105

103106
</div>
104107

@@ -399,9 +402,6 @@
399402

400403
</div>
401404
</div>
402-
403-
<!-- Poll Viewer -->
404-
<poll-viewer v-if="postData.data.thread?.poll" :poll="postData.data.thread.poll" :thread="postData.data.thread" :user-priority="postData.data.posts[0].user.priority" :reset="resetPoll" :banned-from-board="bannedFromBoard"></poll-viewer>
405405
</div>
406406

407407
</div>
@@ -489,6 +489,7 @@ export default {
489489
return postsApi.byThread(params)
490490
.then(data => next(vm => {
491491
vm.postData.data = data
492+
document.title = `${vm.postData.data.thread.title.replaceAll(/&#\d+;/g, '').trim()} - Posts`
492493
vm.checkUsersOnline()
493494
BanStore.updateBanNotice(vm.postData.data.banned_from_board)
494495
vm.bannedFromBoard = vm.postData.data.banned_from_board
@@ -509,6 +510,7 @@ export default {
509510
threadsApi.viewed(threadId)
510511
return postsApi.byThread(params).then(data => {
511512
this.postData.data = data
513+
document.title = `${this.postData.data.thread.title.replaceAll(/&#\d+;/g, '').trim()} - Posts`
512514
this.checkUsersOnline()
513515
BanStore.updateBanNotice(this.postData.data.banned_from_board)
514516
this.bannedFromBoard = this.postData.data.banned_from_board
@@ -1229,7 +1231,6 @@ $postWidth__mobile: calc(100vw - 2rem);
12291231
}
12301232
#public-content {
12311233
.posts & {
1232-
grid-template-columns: minmax(0, 3fr) minmax($sidebarWidth, 1fr);
12331234
grid-template-areas:
12341235
"top sidebar"
12351236
"ads sidebar"

src/views/Profile.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export default {
206206
beforeRouteEnter(to, from, next) {
207207
usersApi.find(to.query.id).then(u => next(vm => {
208208
vm.user = u
209+
document.title = `${vm.user.username} - Profile`
209210
isOnline(u.id, (e, d) => vm.userOnline = d.online)
210211
}))
211212
},
@@ -373,7 +374,6 @@ export default {
373374
.profile-wrap {
374375
grid-column: span 2;
375376
display: grid;
376-
@include grid-columns-base;
377377
grid-template-areas:
378378
"header sidebar"
379379
"main sidebar";

0 commit comments

Comments
 (0)