Dev #2

Merged
sandrodach merged 37 commits from dev into main 2026-10-25 12:14:23 +01:00
2 changed files with 64 additions and 1 deletions
Showing only changes of commit dccf1a91e3 - Show all commits

No files matched your search

+52
View File
@@ -40,6 +40,58 @@ func ExtractTags(content string) []string {
return tags
}
// FormatGermanDateTime formats an ISO-8601 string into "25. Okt. 2026 - 15:40 Uhr"
func FormatGermanDateTime(isoStr string) string {
if isoStr == "" {
return ""
}
var t time.Time
var err error
formats := []string{
time.RFC3339Nano,
time.RFC3339,
"2006-01-02T15:04:05Z07:00",
"2006-01-02T15:04:05",
"2006-01-02 15:04:05",
"2006-01-02",
}
for _, f := range formats {
if parsed, parseErr := time.Parse(f, isoStr); parseErr == nil {
t = parsed
err = nil
break
} else {
err = parseErr
}
}
if err != nil {
return isoStr
}
t = t.Local()
germanMonths := map[time.Month]string{
time.January: "Jan.",
time.February: "Feb.",
time.March: "März",
time.April: "Apr.",
time.May: "Mai",
time.June: "Juni",
time.July: "Juli",
time.August: "Aug.",
time.September: "Sept.",
time.October: "Okt.",
time.November: "Nov.",
time.December: "Dez.",
}
mStr := germanMonths[t.Month()]
if mStr == "" {
mStr = t.Format("Jan")
}
return fmt.Sprintf("%d. %s %d - %02d:%02d Uhr", t.Day(), mStr, t.Year(), t.Hour(), t.Minute())
}
type User struct {
ID string `json:"id"`
Email string `json:"email"`
+12 -1
View File
@@ -812,6 +812,17 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target
title = title[:72] + "…"
}
blocks := make([]domain.DocumentBlock, 0)
formattedDate := domain.FormatGermanDateTime(thought.CreatedAt)
calloutText := "Ursprünglicher Gedanke aus deiner Inbox"
if formattedDate != "" {
calloutText += " vom " + formattedDate
}
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
Type: "callout",
Content: calloutText,
Level: 0,
})
if strings.TrimSpace(thought.Notes) != "" {
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
@@ -831,7 +842,7 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target
})
}
}
if len(blocks) == 0 {
if len(blocks) == 1 {
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
Type: "bullet",