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