refactor(ui): replace neon palette and ad-hoc echo with minimal design system

- reduce color palette to red/cyan/white/gray; alias legacy vars onto CYAN
- add show_box_top/mid/bottom, show_separator, show_menu_item, show_prompt helpers to lib/common.sh
- update apps/index.sh and tools/index.sh to use new UI helpers instead of inline echo/ANSI
- drop BLINK, REV escape codes and remove hardcoded prompt strings from callers
This commit is contained in:
2026-05-12 22:20:36 -04:00
parent ade8e76a68
commit c7dcaed0bf
4 changed files with 141 additions and 72 deletions
+18 -25
View File
@@ -120,15 +120,7 @@ check_remote_version() {
}
show_lxs_logo() {
local cols head tail_len
cols=$(tput cols 2>/dev/null || echo 64)
head=" L X S // v${LXS_VERSION} "
tail_len=$(( cols - ${#head} - 12 ))
[ "$tail_len" -lt 4 ] && tail_len=4
local bar
bar=$(printf '▀%.0s' $(seq 1 "$tail_len"))
echo ""
echo -e "${YELLOW}▀▀▀${WHITE}${BOLD}${head}${NC}${YELLOW}${bar}${NC} ${GREEN}[ONLINE]${NC}"
show_box_top "LXS // v${LXS_VERSION}" "ONLINE"
}
show_header() {
@@ -136,7 +128,8 @@ show_header() {
show_lxs_logo
if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then
echo -e "${YELLOW}▲ UPDATE_AVAILABLE :: v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}"
echo ""
echo -e " ${CYAN}[!!] UPDATE_AVAILABLE${NC} ${WHITE}v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}"
fi
local hostname os_version kernel uptime_info ip_address cpu_cores total_mem used_mem disk_usage
@@ -151,10 +144,10 @@ show_header() {
disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}')
echo ""
printf " ${CYAN}NODE${NC} %-22s ${CYAN}KERN${NC} %s\n" "$hostname" "$kernel"
printf " ${CYAN}ADDR${NC} %-22s ${CYAN}UP${NC} %s\n" "$ip_address" "$uptime_info"
printf " ${CYAN}OS${NC} %-22s ${CYAN}CPU${NC} %s cores\n" "$os_version" "$cpu_cores"
printf " ${CYAN}DISK${NC} %-22s ${CYAN}MEM${NC} %s / %s\n" "$disk_usage" "$used_mem" "$total_mem"
printf " ${CYAN}NODE${NC} ${WHITE}%-26s${NC} ${CYAN}KERN${NC} ${WHITE}%s${NC}\n" "$hostname" "$kernel"
printf " ${CYAN}ADDR${NC} ${WHITE}%-26s${NC} ${CYAN}UP${NC} ${WHITE}%s${NC}\n" "$ip_address" "$uptime_info"
printf " ${CYAN}OS${NC} ${WHITE}%-26s${NC} ${CYAN}CPU${NC} ${WHITE}%s cores${NC}\n" "$os_version" "$cpu_cores"
printf " ${CYAN}DISK${NC} ${WHITE}%-26s${NC} ${CYAN}MEM${NC} ${WHITE}%s / %s${NC}\n" "$disk_usage" "$used_mem" "$total_mem"
echo ""
}
@@ -197,7 +190,7 @@ download_and_run() {
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo ""
echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}"
echo -e "${CYAN}[..] Fetching ${BOLD}${script_name}${NC}${CYAN}...${NC}"
if curl -fsSL -H "Cache-Control: no-cache" \
-o "${temp_file}" \
@@ -304,7 +297,7 @@ lxs_sync_install() {
}
trap 'rm -rf "$work"' RETURN
echo -e "${MAGENTA}[··] Fetching ${LXS_TARBALL_URL}...${NC}"
echo -e "${CYAN}[..] Fetching ${LXS_TARBALL_URL}...${NC}"
if ! curl -fsSL -H "Cache-Control: no-cache" -o "${work}/lxs.tgz" "$LXS_TARBALL_URL"; then
echo -e "${RED}[KO] Download failed${NC}"
return 1
@@ -372,18 +365,18 @@ cmd_install_self() {
main_menu() {
check_os
check_remote_version
local hostname
hostname=$(hostname 2>/dev/null || echo "${HOSTNAME:-node}")
while true; do
show_header
echo -e "${MAGENTA}>> SELECT_PROTOCOL <<${NC}"
show_box_mid "SELECT"
echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}APPLICATIONS${NC} ${GRAY}// deploy stacks${NC}"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}TOOLS${NC} ${GRAY}// sysadmin daemons${NC}"
echo -e " ${YELLOW}◢ UU${NC} ${GRAY}${NC} ${WHITE}FETCH_UPDATE${NC} ${GRAY}// sync remote${NC}"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}JACK_OUT${NC} ${GRAY}// exit shell${NC}"
show_menu_item "01" "APPLICATIONS" "deploy stacks"
show_menu_item "02" "TOOLS" "sysadmin daemons"
show_menu_item "UU" "FETCH_UPDATE" "sync remote"
show_menu_item "00" "JACK_OUT" "exit shell" exit
echo ""
echo -e -n "${MAGENTA}jack_in${NC}@${CYAN}${hostname}${NC} ${YELLOW}${NC}${MAGENTA}_${NC} "
show_box_bottom
echo ""
show_prompt
read -r choice
case $choice in
@@ -399,7 +392,7 @@ main_menu() {
0|00)
clear
show_lxs_logo
echo -e "${MAGENTA}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n"
echo -e "${CYAN}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n"
exit 0
;;
*) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;;