prime8dev

prime8dev
git clone https://git.prime8.dev/prime8dev.git
Log | Files | Refs | README | LICENSE

tags.go (1907B)


      1 package tui
      2 
      3 import "strings"
      4 
      5 func renderTag(label string) string {
      6 	style, ok := tagStyles[tagClassKey(label)]
      7 	if !ok {
      8 		style = tagDefaultStyle
      9 	}
     10 	return style.Render(label)
     11 }
     12 
     13 func renderTagList(labels []string) string {
     14 	if len(labels) == 0 {
     15 		return ""
     16 	}
     17 	out := make([]string, 0, len(labels))
     18 	for _, label := range labels {
     19 		if strings.TrimSpace(label) == "" {
     20 			continue
     21 		}
     22 		out = append(out, renderTag(label))
     23 	}
     24 	return strings.Join(out, " ")
     25 }
     26 
     27 func tagClassKey(label string) string {
     28 	v := strings.ToLower(strings.TrimSpace(label))
     29 	switch v {
     30 	case "zig":
     31 		return "lang-zig"
     32 	case "rust":
     33 		return "lang-rust"
     34 	case "c":
     35 		return "lang-c"
     36 	case "go", "golang":
     37 		return "lang-go"
     38 	case "typescript", "ts":
     39 		return "lang-ts"
     40 	case "astro":
     41 		return "tech-astro"
     42 	case "python":
     43 		return "lang-python"
     44 	case "zed", "zed (vim mode)":
     45 		return "tool-zed"
     46 	case "neovim":
     47 		return "tool-neovim"
     48 	case "opencode":
     49 		return "tool-opencode"
     50 	case "linux":
     51 		return "tool-linux"
     52 	case "fish":
     53 		return "tool-fish"
     54 	case "ghostty":
     55 		return "tool-ghostty"
     56 	case "low-level systems", "low level systems":
     57 		return "interest-lowlevel"
     58 	case "tui/cli tooling", "tui cli tooling", "tui":
     59 		return "interest-tui"
     60 	case "embedded", "embedded systems":
     61 		return "interest-embedded"
     62 	case "unix philosophy", "unix":
     63 		return "interest-unix"
     64 	case "web development", "webdev", "web dev":
     65 		return "interest-webdev"
     66 	case "temporal":
     67 		return "tech-temporal"
     68 	case "postgres", "postgresql":
     69 		return "tech-postgres"
     70 	case "pytorch":
     71 		return "tech-pytorch"
     72 	case "cuda":
     73 		return "tech-cuda"
     74 	case "docker":
     75 		return "tech-docker"
     76 	case "kafka":
     77 		return "tech-kafka"
     78 	case "react native", "react-native", "rn":
     79 		return "tech-rn"
     80 	case "supabase":
     81 		return "tech-supabase"
     82 	case "rest":
     83 		return "tech-rest"
     84 	case "portfolio", "portfolio site":
     85 		return "project-portfolio"
     86 	default:
     87 		return ""
     88 	}
     89 }