Skip to content

Commit

Permalink
Revisit comments layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceylo committed Oct 30, 2022
1 parent 16dbb07 commit f91ada9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion FAKit/Sources/FAKit/FASubmission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension FASubmission.Comment {
displayAuthor: comment.displayAuthor,
authorAvatarUrl: comment.authorAvatarUrl,
datetime: comment.datetime,
htmlMessage: comment.htmlMessage.selfContainedFAHtml,
htmlMessage: comment.htmlMessage.selfContainedFAHtmlComment,
answers: [])
}

Expand Down
13 changes: 13 additions & 0 deletions FAKit/Sources/FAKit/String+FA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ extension String {
.replacingOccurrences(of: "src=\"//", with: "src=\"https://")
.replacingOccurrences(of: "src=\"/", with: "src=\"https://www.furaffinity.net/")
}

public var selfContainedFAHtmlComment: String {
"""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" class="no-js" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="https://www.furaffinity.net/themes/beta/css/ui_theme_dark.css" />
</head>
<body>\(self)</body>
</html>
"""
}

enum FATheme {
case light
Expand Down
8 changes: 4 additions & 4 deletions FurAffinity/Helpers/FASession+CanvasPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ extension FASubmission {
let htmlDescription = "YCH for \n<a href=\"/user/mikazukihellfire\" class=\"iconusername\"><img src=\"//a.furaffinity.net/20211017/mikazukihellfire.gif\" align=\"middle\" title=\"MikazukiHellfire\" alt=\"MikazukiHellfire\">&nbsp;MikazukiHellfire</a>\n<br> \n<br> Medea © \n<a href=\"/user/mikazukihellfire\" class=\"iconusername\"><img src=\"//a.furaffinity.net/20211017/mikazukihellfire.gif\" align=\"middle\" title=\"MikazukiHellfire\" alt=\"MikazukiHellfire\">&nbsp;MikazukiHellfire</a>\n<br> \n<br> \n<br> \n<br> \n<br> *******************************\n<br> * \n<a class=\"auto_link named_url\" href=\"http://ko-fi.com/J3J16KSH\">Feed me with coffee?</a>\n<br> * \n<a class=\"auto_link named_url\" href=\"https://www.furaffinity.net/gallery/annetpeas/\">My Gallery</a>\n<br> * \n<a class=\"auto_link named_url\" href=\"https://twitter.com/AnnetPeas_Art\">Twitter</a>"
let terrinissAvatarUrl = URL(string: "https://a.furaffinity.net/1616615925/terriniss.gif")!
let comments: [FASubmission.Comment] = [
.init(cid: 166652793, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "BID HERE \n<br> Moon", answers: [
.init(cid: 166653891, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "SakuraSlowly (DA) - SB", answers: [
.init(cid: 166658565, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "DeathPanda21 (da) - 55$", answers: [])
.init(cid: 166652793, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "BID HERE \n<br> Moon".selfContainedFAHtmlComment, answers: [
.init(cid: 166653891, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "SakuraSlowly (DA) - SB".selfContainedFAHtmlComment, answers: [
.init(cid: 166658565, displayAuthor: "Terriniss", authorAvatarUrl: terrinissAvatarUrl, datetime: "2 months ago", htmlMessage: "DeathPanda21 (da) - 55$".selfContainedFAHtmlComment, answers: [])
])
]),
.init(cid: 166653340, displayAuthor: "RuruDasPippen", authorAvatarUrl: URL(string: "https://a.furaffinity.net/1643948243/rurudaspippen.gif")!, datetime: "2 months ago", htmlMessage: "Look at the babies!", answers: [])
.init(cid: 166653340, displayAuthor: "RuruDasPippen", authorAvatarUrl: URL(string: "https://a.furaffinity.net/1643948243/rurudaspippen.gif")!, datetime: "2 months ago", htmlMessage: "Look at the babies!".selfContainedFAHtmlComment, answers: [])
]

return FASubmission(
Expand Down
1 change: 1 addition & 0 deletions FurAffinity/Submissions/SubmissionCommentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct SubmissionCommentView: View {
HStack(alignment: .top) {
AvatarView(avatarUrl: comment.authorAvatarUrl)
.frame(width: 32, height: 32)
.padding(.top, 5)

VStack(alignment: .leading, spacing: 0) {
HStack(alignment: .firstTextBaseline) {
Expand Down
2 changes: 1 addition & 1 deletion FurAffinity/Submissions/SubmissionCommentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct SubmissionCommentsView: View {
var comments: [FASubmission.Comment]

func commentViews(for comments: [FASubmission.Comment], indent: Bool) -> some View {
VStack(alignment: .leading) {
VStack(alignment: .leading, spacing: 5) {
ForEach(comments) { comment in
SubmissionCommentView(comment: comment)
AnyView(commentViews(for: comment.answers, indent: true))
Expand Down

0 comments on commit f91ada9

Please sign in to comment.