workspace.ts

  1import Theme from "../themes/common/theme";
  2import { withOpacity } from "../utils/color";
  3import {
  4  backgroundColor,
  5  border,
  6  iconColor,
  7  modalShadow,
  8  popoverShadow,
  9  text,
 10} from "./components";
 11import statusBar from "./statusBar";
 12import tabBar from "./tabBar";
 13
 14export function workspaceBackground(theme: Theme) {
 15  return backgroundColor(theme, 300);
 16}
 17
 18export default function workspace(theme: Theme) {
 19  const titlebarPadding = 6;
 20
 21  return {
 22    background: backgroundColor(theme, 300),
 23    joiningProjectAvatar: {
 24      cornerRadius: 40,
 25      width: 80,
 26    },
 27    joiningProjectMessage: {
 28      padding: 12,
 29      ...text(theme, "sans", "primary", { size: "lg" }),
 30    },
 31    leaderBorderOpacity: 0.7,
 32    leaderBorderWidth: 2.0,
 33    tabBar: tabBar(theme),
 34    modal: {
 35      margin: {
 36        bottom: 52,
 37        top: 52,
 38      },
 39      cursor: "Arrow",
 40    },
 41    sidebar: {
 42      initialSize: 240,
 43      border: {
 44        color: border(theme, "primary").color,
 45        width: 1,
 46        left: true,
 47        right: true,
 48      }
 49    },
 50    paneDivider: {
 51      color: border(theme, "secondary").color,
 52      width: 1,
 53    },
 54    statusBar: statusBar(theme),
 55    titlebar: {
 56      avatarWidth: 18,
 57      avatarMargin: 8,
 58      height: 33,
 59      background: backgroundColor(theme, 100),
 60      padding: {
 61        left: 80,
 62        right: titlebarPadding,
 63      },
 64      title: text(theme, "sans", "primary"),
 65      avatar: {
 66        cornerRadius: 10,
 67        border: {
 68          color: "#00000088",
 69          width: 1,
 70        },
 71      },
 72      avatarRibbon: {
 73        height: 3,
 74        width: 12,
 75        // TODO: The background for this ideally should be
 76        // set with a token, not hardcoded in rust
 77      },
 78      border: border(theme, "primary", { bottom: true, overlay: true }),
 79      signInPrompt: {
 80        background: backgroundColor(theme, 100),
 81        border: border(theme, "secondary"),
 82        cornerRadius: 6,
 83        margin: {
 84          top: 1,
 85        },
 86        padding: {
 87          top: 1,
 88          bottom: 1,
 89          left: 7,
 90          right: 7,
 91        },
 92        ...text(theme, "sans", "secondary", { size: "xs" }),
 93        hover: {
 94          ...text(theme, "sans", "active", { size: "xs" }),
 95          background: backgroundColor(theme, "on300", "hovered"),
 96          border: border(theme, "primary"),
 97        },
 98      },
 99      offlineIcon: {
100        color: iconColor(theme, "secondary"),
101        width: 16,
102        margin: {
103          left: titlebarPadding,
104        },
105        padding: {
106          right: 4,
107        },
108      },
109      outdatedWarning: {
110        ...text(theme, "sans", "warning", { size: "xs" }),
111        background: backgroundColor(theme, "warning"),
112        border: border(theme, "warning"),
113        margin: {
114          left: titlebarPadding,
115        },
116        padding: {
117          left: 6,
118          right: 6,
119        },
120        cornerRadius: 6,
121      },
122      toggleContactsButton: {
123        cornerRadius: 6,
124        color: iconColor(theme, "secondary"),
125        iconWidth: 8,
126        buttonWidth: 20,
127        active: {
128          background: backgroundColor(theme, "on300", "active"),
129          color: iconColor(theme, "active"),
130        },
131        hover: {
132          background: backgroundColor(theme, "on300", "hovered"),
133          color: iconColor(theme, "active"),
134        },
135      },
136      contactsPopover: {
137        background: backgroundColor(theme, 300, "base"),
138        cornerRadius: 6,
139        padding: { top: 6 },
140        shadow: popoverShadow(theme),
141        border: border(theme, "primary"),
142        margin: { top: -5 },
143        width: 250,
144        height: 300
145      }
146    },
147    toolbar: {
148      height: 34,
149      background: backgroundColor(theme, 500),
150      border: border(theme, "secondary", { bottom: true }),
151      itemSpacing: 8,
152      navButton: {
153        color: iconColor(theme, "primary"),
154        iconWidth: 12,
155        buttonWidth: 24,
156        cornerRadius: 6,
157        hover: {
158          color: iconColor(theme, "active"),
159          background: backgroundColor(theme, "on500", "hovered"),
160        },
161        disabled: {
162          color: withOpacity(iconColor(theme, "muted"), 0.6),
163        },
164      },
165      padding: { left: 8, right: 8, top: 4, bottom: 4 },
166    },
167    breadcrumbs: {
168      ...text(theme, "mono", "secondary"),
169      padding: { left: 6 },
170    },
171    disconnectedOverlay: {
172      ...text(theme, "sans", "active"),
173      background: withOpacity(theme.backgroundColor[500].base, 0.8),
174    },
175    notification: {
176      margin: { top: 10 },
177      background: backgroundColor(theme, 300),
178      cornerRadius: 6,
179      padding: 12,
180      border: border(theme, "primary"),
181      shadow: modalShadow(theme),
182    },
183    notifications: {
184      width: 400,
185      margin: { right: 10, bottom: 10 },
186    },
187    dock: {
188      initialSizeRight: 640,
189      initialSizeBottom: 480,
190      wash_color: withOpacity(theme.backgroundColor[500].base, 0.5),
191      panel: {
192        border: {
193          ...border(theme, "secondary"),
194          width: 1
195        },
196      },
197      maximized: {
198        margin: 24,
199        border: border(theme, "secondary", { "overlay": true }),
200        shadow: modalShadow(theme),
201      }
202    }
203  };
204}