contactsPanel.ts

  1import Theme from "../themes/theme";
  2import { panel } from "./app";
  3import { backgroundColor, border, borderColor, iconColor, player, text } from "./components";
  4
  5export default function contactsPanel(theme: Theme) {
  6  const nameMargin = 8;
  7  const sidePadding = 12;
  8
  9  const projectRow = {
 10    guestAvatarSpacing: 4,
 11    height: 24,
 12    guestAvatar: {
 13      cornerRadius: 8,
 14      width: 14,
 15    },
 16    name: {
 17      ...text(theme, "mono", "placeholder", { size: "sm" }),
 18      margin: {
 19        left: nameMargin,
 20        right: 6,
 21      },
 22    },
 23    guests: {
 24      margin: {
 25        left: nameMargin,
 26        right: nameMargin,
 27      }
 28    },
 29    padding: {
 30      left: sidePadding,
 31      right: sidePadding,
 32    },
 33  };
 34
 35  const contactButton = {
 36    background: backgroundColor(theme, 100),
 37    color: iconColor(theme, "primary"),
 38    iconWidth: 8,
 39    buttonWidth: 16,
 40    cornerRadius: 8,
 41  };
 42
 43  return {
 44    ...panel,
 45    userQueryEditor: {
 46      background: backgroundColor(theme, 500),
 47      cornerRadius: 6,
 48      text: text(theme, "mono", "primary"),
 49      placeholderText: text(theme, "mono", "placeholder", { size: "sm" }),
 50      selection: player(theme, 1).selection,
 51      border: border(theme, "secondary"),
 52      padding: {
 53        bottom: 4,
 54        left: 8,
 55        right: 8,
 56        top: 4,
 57      },
 58      margin: {
 59        left: sidePadding,
 60        right: sidePadding,
 61      }
 62    },
 63    userQueryEditorHeight: 32,
 64    addContactButton: {
 65      margin: { left: 6, right: 12 },
 66      color: iconColor(theme, "primary"),
 67      buttonWidth: 8,
 68      iconWidth: 8,
 69    },
 70    rowHeight: 28,
 71    sectionIconSize: 8,
 72    headerRow: {
 73      ...text(theme, "mono", "secondary", { size: "sm" }),
 74      margin: { top: 14 },
 75      padding: {
 76        left: sidePadding,
 77        right: sidePadding,
 78      },
 79      active: {
 80        ...text(theme, "mono", "primary", { size: "sm" }),
 81        background: backgroundColor(theme, 100, "active"),
 82      }
 83    },
 84    contactRow: {
 85      padding: {
 86        left: sidePadding,
 87        right: sidePadding
 88      },
 89      active: {
 90        background: backgroundColor(theme, 100, "active"),
 91      }
 92    },
 93    treeBranch: {
 94      color: borderColor(theme, "active"),
 95      width: 1,
 96      hover: {
 97        color: borderColor(theme, "active"),
 98      },
 99      active: {
100        color: borderColor(theme, "active"),
101      }
102    },
103    contactAvatar: {
104      cornerRadius: 10,
105      width: 18,
106    },
107    contactUsername: {
108      ...text(theme, "mono", "primary", { size: "sm" }),
109      margin: {
110        left: nameMargin,
111      },
112    },
113    contactButtonSpacing: nameMargin,
114    contactButton: {
115      ...contactButton,
116      hover: {
117        background: backgroundColor(theme, 100, "hovered"),
118      },
119    },
120    disabledContactButton: {
121      ...contactButton,
122      background: backgroundColor(theme, 100),
123      color: iconColor(theme, "muted"),
124    },
125    sharedProjectRow: {
126      ...projectRow,
127      background: backgroundColor(theme, 300),
128      name: {
129        ...projectRow.name,
130        ...text(theme, "mono", "secondary", { size: "sm" }),
131      },
132      hover: {
133        background: backgroundColor(theme, 300, "hovered"),
134      },
135      active: {
136        background: backgroundColor(theme, 300, "active"),
137      }
138    },
139    unsharedProjectRow: {
140      ...projectRow,
141      background: backgroundColor(theme, 300),
142      name: {
143        ...projectRow.name,
144        ...text(theme, "mono", "secondary", { size: "sm" }),
145      },
146      hover: {
147        background: backgroundColor(theme, 300, "hovered"),
148      },
149      active: {
150        background: backgroundColor(theme, 300, "active"),
151      }
152    }
153  }
154}