Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support markdown input and preview in beatmap discussions #9991

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ff88434
always put message below actions
notbakaneko Feb 21, 2023
9c5c63d
move editor out
notbakaneko Feb 21, 2023
06b3738
disable shift for new line
notbakaneko Feb 21, 2023
b506db3
wip
notbakaneko Feb 21, 2023
722d6b5
switching
notbakaneko Feb 27, 2023
7f35e09
seperate switcher
notbakaneko Feb 27, 2023
c220c5f
...what
notbakaneko Feb 28, 2023
9b36892
add switcher to replies
notbakaneko Feb 28, 2023
91e728f
probably easier to put switcher separate from post
notbakaneko Mar 8, 2023
0d3d81b
reset input
notbakaneko Mar 8, 2023
c805ffc
move header nav parts to own component
notbakaneko Mar 8, 2023
9dd2ad5
or maybe not
notbakaneko Mar 8, 2023
2bec358
moving elements wip
notbakaneko Mar 8, 2023
e2877b7
moving all post elements into the post itself
notbakaneko Mar 9, 2023
a6f1ba6
move more into post
notbakaneko Mar 9, 2023
4e3f9dd
more reorganizing elements and style
notbakaneko Mar 10, 2023
652820b
shift some values to css variables
notbakaneko Mar 10, 2023
6a8ff80
remove negative margin
notbakaneko Mar 10, 2023
1323ab4
rename function
notbakaneko Mar 10, 2023
49d0476
more grid adjustments
notbakaneko Mar 10, 2023
45a81e1
smaller editor text area
notbakaneko Mar 10, 2023
d0d60f6
use flex gap and css variables instead of gutter math
notbakaneko Mar 10, 2023
1e7037a
maintain padding for urlless items
notbakaneko Mar 13, 2023
273c686
$gap is quite far away...
notbakaneko Mar 13, 2023
612475f
padding useless since not visbile on mobile
notbakaneko Mar 13, 2023
2e65b7c
separate the editor style
notbakaneko Mar 14, 2023
6cb70a7
add markdown editor to replies, separate new-reply styles from post
notbakaneko Mar 14, 2023
da38030
unset editing when unmounting (message disappears when remounting)
notbakaneko Mar 14, 2023
fea40a6
more tidying up
notbakaneko Mar 14, 2023
bf74510
doesn't do anything
notbakaneko Mar 14, 2023
f1dea60
markdown editor for new disucssions
notbakaneko Mar 15, 2023
6297f89
skip textarea if can't post new discussion
notbakaneko Mar 15, 2023
a3e5dc6
Merge branch 'master' into feature/discussion-post-markdown-preview
notbakaneko Apr 11, 2023
5e5da6d
Merge branch 'master' into feature/discussion-post-markdown-preview
notbakaneko Apr 11, 2023
d5d6110
fix test
notbakaneko Apr 11, 2023
0d72fbf
fix casing, remove unused
notbakaneko Apr 11, 2023
6b16274
use localized text
notbakaneko Apr 11, 2023
2c38651
scroll button completely into view before clicking
notbakaneko Apr 11, 2023
86327f1
Merge branch 'master' into feature/discussion-post-markdown-preview
notbakaneko May 9, 2023
600f550
consistent colour and font size
notbakaneko May 9, 2023
4c15eaf
missing ref when jumping to review post when editor is pinned
notbakaneko May 9, 2023
123aacf
that's not a valid modifier
notbakaneko May 9, 2023
a2c0a83
fix position of pinned element on mount
notbakaneko May 9, 2023
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
Binary file added database/ip2asn.idx
Binary file not shown.
599,388 changes: 599,388 additions & 0 deletions database/ip2asn.tsv

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions resources/css/bem-index.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@import "bem/beatmap-discussion-expand";
@import "bem/beatmap-discussion-new";
@import "bem/beatmap-discussion-new-float";
@import "bem/beatmap-discussion-new-reply";
@import "bem/beatmap-discussion-nomination";
@import "bem/beatmap-discussion-post";
@import "bem/beatmap-discussion-review-post";
Expand Down Expand Up @@ -211,6 +212,7 @@
@import "bem/login-box";
@import "bem/logo";
@import "bem/love-beatmap-modal";
@import "bem/markdown-editor";
@import "bem/medals-group";
@import "bem/message-length-counter";
@import "bem/mobile-menu";
Expand Down
2 changes: 1 addition & 1 deletion resources/css/bem/beatmap-discussion-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
.default-border-radius();

.@{_top}--edit-mode & {
margin: 0 -@padding;
margin: 0;
border: 2px solid hsl(200, 60%, 50%);
}

Expand Down
71 changes: 71 additions & 0 deletions resources/css/bem/beatmap-discussion-new-reply.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

.beatmap-discussion-new-reply {
display: flex;
justify-content: flex-end;
padding: 10px;
border-radius: 0 0 @border-radius-base @border-radius-base;

&--editing {
display: grid;
grid-template-areas: "user actions" "message message" "footer footer";
grid-template-columns: 1fr auto;
gap: 10px;
justify-content: unset;

@media @desktop {
grid-template-areas: "user container" "user footer";
grid-template-columns: auto 1fr;
row-gap: 0;
}
}

@media @desktop {
padding-left: @beatmap-discussion--reply-padding;
}

&__actions {
display: flex;
gap: 5px;
justify-content: flex-end;
}

&__avatar {
width: @beatmap-discussion--avatar-size;
height: @beatmap-discussion--avatar-size;
}

&__cancel {
.reset-input();
float: right;
color: hsl(var(--hsl-f1));
width: @beatmap-discussion--avatar-size;
height: @beatmap-discussion--avatar-size;
}

&__container {
grid-area: container;

@media @mobile {
grid-area: unset;
display: contents;
}
}

&__footer {
grid-area: footer;
}

&__message-container {
grid-area: message;
}

&__notice {
display: flex;
align-items: flex-end;
justify-content: space-between;
font-size: @font-size--normal;
color: hsl(var(--hsl-f1));
}
}
9 changes: 3 additions & 6 deletions resources/css/bem/beatmap-discussion-new.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

&__content {
display: flex;
gap: 10px;
padding: 0 @_side-padding 10px;
}

Expand Down Expand Up @@ -72,13 +73,9 @@

&__message {
.content-font();
color: @osu-colour-f1;
flex: 1;
padding-left: 10px;
font-size: @font-size--title-small-2;

display: flex;
flex-direction: column;
flex: 1;
color: hsl(var(--hsl-f1));
}

&__message-area {
Expand Down
174 changes: 31 additions & 143 deletions resources/css/bem/beatmap-discussion-post.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,22 @@

@_content-gutter-base: 15px;

transition: background-color .1s ease-in-out;
display: grid;
grid-template-areas: "user actions" "message message";
grid-template-columns: 1fr auto;
gap: 10px;

&--deleted {
opacity: 0.5;
}

&--discussion {
min-width: 0;

@media @desktop {
flex: 1;
}
@media @desktop {
grid-template-areas: "user container";
grid-template-columns: auto 1fr;
row-gap: 0;
}

&--new-reply {
background-color: @osu-colour-b5;
border-radius: 0 0 @border-radius-base @border-radius-base;
}
padding: 10px;
transition: background-color .1s ease-in-out;

&--new-reply-placeholder {
padding: 10px;
display: flex;
justify-content: flex-end;
background-color: transparent;
&--deleted {
opacity: 0.5;
}

&--unread {
Expand All @@ -49,48 +41,24 @@
}

&__action {
margin: 0 5px;
text-transform: lowercase;

&--button {
&--plain {
.reset-input();
.link-plain();
.link-default();
// reset function above overrides margin
margin: 0 5px;
font-size: @font-size--small;
}

&--cancel {
.reset-input();
position: absolute;
color: @osu-colour-f1;
right: 0;
width: @beatmap-discussion--reply-padding;
height: @beatmap-discussion--reply-padding;
font-size: @font-size--small;
}
}

&__actions {
display: flex;
gap: 5px;

.@{_top}--editing & {
justify-content: flex-end;
}

.@{_top}--new-reply & {
justify-content: flex-end;
}

.@{_top}--editing.@{_top}--reply & {
margin-top: 5px;
}
}

&__actions-group {
display: flex;
align-items: center;
margin: 0 -5px;
}

&__avatar {
Expand All @@ -105,62 +73,12 @@
}
}

&__content {
display: flex;
padding: 10px @_content-gutter-base;
flex-direction: column;
flex: none;
min-width: 0;
&__container {
grid-area: container;

@media @desktop {
flex-direction: row;
flex: 1;
}

// Paddings for thread starter is handled by its parent.
.@{_top}--discussion & {
padding: 0;
}

.@{_top}--reply & {
// override padding for discussion previews
.beatmap-discussion--preview &,
.beatmap-discussion-review-post-embed & {
padding: 10px @_content-gutter-base;
}

@media @desktop {
padding-left: @beatmap-discussion--reply-padding;
padding-right: @beatmap-discussion--reply-padding;
}
}

.@{_top}--new-reply & {
padding-bottom: 0;
}
}

&__footer {
padding: 10px;

&--notice {
padding-top: 0;
padding-bottom: 0;
display: flex;
align-items: flex-end;
justify-content: space-between;
font-size: @font-size--normal;
color: @osu-colour-f1;
}

.@{_top}--reply & {
padding-left: @_content-gutter-base;
padding-right: @_content-gutter-base;

@media @desktop {
padding-left: @beatmap-discussion--reply-padding;
padding-right: @beatmap-discussion--reply-padding;
}
@media @mobile {
grid-area: unset;
display: contents;
}
}

Expand All @@ -173,15 +91,7 @@
&__info-container {
display: flex;
flex-wrap: wrap;

.@{_top}--reply & {
&::after {
content: '';
height: 1px;
align-self: center;
flex: 1;
}
}
margin-top: 10px;
}

&__info-user {
Expand All @@ -191,47 +101,25 @@

&__message {
.content-font();
grid-area: message;
word-break: break-word;
margin-bottom: 10px;
color: white;
font-size: @_discussion-text-size;
}

.@{_top}--discussion & {
font-size: @_discussion-text-size;
}

.@{_top}--reply & {
font-size: @_reply-text-size;
}

&::placeholder {
color: @osu-colour-f1;
}
&__message-container {
grid-area: message;

&--editor {
.reset-input();
width: 100%;
resize: vertical;
min-height: 3em;

// --reply part to override top modifier
&, .@{_top}--reply & {
font-size: @font-size--phone-input;

@media @desktop {
font-size: @_reply-text-size;
}
}
&--review {
clear: both;
}
}

&__message-container {
min-width: 0;
display: flex;
flex-direction: column;
flex: none;
&__user {
grid-area: user;

@media @desktop {
flex: 1;
border-right: 2px solid var(--group-colour, hsl(var(--hsl-b5)));
}
}
}
15 changes: 0 additions & 15 deletions resources/css/bem/beatmap-discussion-user-card.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

@media @desktop {
margin-bottom: 0;
margin-right: 10px;
}

&__avatar {
Expand Down Expand Up @@ -72,18 +71,4 @@
display: flex;
align-items: baseline;
}

&__user-stripe {
align-self: stretch;
background-color: var(--group-colour, @osu-colour-b5);
border-radius: 1px;
flex: none;
width: 2px;

.beatmap-discussion-post--discussion & {
@media @mobile {
display: none;
}
}
}
}
Loading