Live Music & Generic Statuses

Changelog-Added: Added live music statuses
Changelog-Added: Added generic user statuses
This commit is contained in:
William Casarin
2023-08-21 22:12:01 -07:00
parent 59cf8056bd
commit 0338297bfe
18 changed files with 537 additions and 55 deletions

View File

@@ -34,7 +34,6 @@ struct EventTop: View {
Spacer()
EventMenuContext(damus: state, event: event)
}
.lineLimit(1)
}
}

View File

@@ -43,8 +43,11 @@ struct EventProfile: View {
ProfilePicView(pubkey: pubkey, size: pfp_size, highlight: .none, profiles: damus_state.profiles, disable_animation: disable_animation)
}
}
EventProfileName(pubkey: pubkey, profile: profile, damus: damus_state, size: size)
VStack(alignment: .leading) {
EventProfileName(pubkey: pubkey, profile: profile, damus: damus_state, size: size)
UserStatusView(status: damus_state.profiles.profile_data(pubkey).status)
}
}
}
}

View File

@@ -93,8 +93,9 @@ struct EventShell<Content: View>: View {
HStack(spacing: 10) {
Pfp(is_anon: is_anon)
VStack {
VStack(alignment: .leading, spacing: 2) {
EventTop(state: state, event: event, pubkey: pubkey, is_anon: is_anon)
UserStatusView(status: state.profiles.profile_data(pubkey).status)
ReplyPart(events: state.events, event: event, privkey: state.keypair.privkey, profiles: state.profiles)
}
}

View File

@@ -49,7 +49,7 @@ struct SelectedEventView: View {
.padding(.horizontal)
.minimumScaleFactor(0.75)
.lineLimit(1)
if event_is_reply(event.event_refs(damus.keypair.privkey)) {
ReplyDescription(event: event, replying_to: replying_to, profiles: damus.profiles)
.padding(.horizontal)

View File

@@ -55,7 +55,7 @@ struct EventProfileName: View {
return donation
}
var body: some View {
HStack(spacing: 2) {
switch current_display_name {

View File

@@ -0,0 +1,20 @@
//
// ProfilePopup.swift
// damus
//
// Created by William Casarin on 2023-08-21.
//
import SwiftUI
struct ProfilePopup: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct ProfilePopup_Previews: PreviewProvider {
static var previews: some View {
ProfilePopup()
}
}

View File

@@ -83,23 +83,37 @@ struct SideMenuView: View {
var TopProfile: some View {
let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
return HStack {
ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
return VStack(alignment: .leading, spacing: verticalSpacing) {
HStack {
ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
VStack(alignment: .leading) {
if let display_name = profile?.display_name {
Text(display_name)
.foregroundColor(textColor())
.font(.title)
.lineLimit(1)
}
if let name = profile?.name {
Text("@" + name)
.foregroundColor(DamusColors.mediumGrey)
.font(.body)
.lineLimit(1)
VStack(alignment: .leading) {
if let display_name = profile?.display_name {
Text(display_name)
.foregroundColor(textColor())
.font(.title)
.lineLimit(1)
}
if let name = profile?.name {
Text("@" + name)
.foregroundColor(DamusColors.mediumGrey)
.font(.body)
.lineLimit(1)
}
}
}
navLabel(title: NSLocalizedString("Set Status", comment: "Sidebar menu label to set user status"), img: "add-reaction")
.font(.title2)
.foregroundColor(textColor())
.frame(maxWidth: .infinity, alignment: .leading)
.dynamicTypeSize(.xSmall)
.onTapGesture {
present_sheet(.user_status)
}
UserStatusView(status: damus_state.profiles.profile_data(damus_state.pubkey).status)
.dynamicTypeSize(.xSmall)
}
}
@@ -190,17 +204,17 @@ struct SideMenuView: View {
}
}
@ViewBuilder
func navLabel(title: String, img: String) -> some View {
Image(img)
.tint(DamusColors.adaptableBlack)
Text(title)
.font(.title2)
.foregroundColor(textColor())
.frame(maxWidth: .infinity, alignment: .leading)
.dynamicTypeSize(.xSmall)
HStack {
Image(img)
.tint(DamusColors.adaptableBlack)
Text(title)
.font(.title2)
.foregroundColor(textColor())
.frame(maxWidth: .infinity, alignment: .leading)
.dynamicTypeSize(.xSmall)
}
}
struct SideMenuLabelStyle: LabelStyle {