workspace.ts

  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 titlebarHeight = 33;
 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: titlebarHeight,
 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      addCollaboratorButton: {
123        cornerRadius: 6,
124        color: iconColor(theme, "secondary"),
125        iconWidth: 8,
126        buttonWidth: 20,
127        hover: {
128          background: backgroundColor(theme, "on300", "hovered"),
129          color: iconColor(theme, "active"),
130        },
131      },
132    },
133    toolbar: {
134      height: 34,
135      background: backgroundColor(theme, 500),
136      border: border(theme, "secondary", { bottom: true }),
137      itemSpacing: 8,
138      navButton: {
139        color: iconColor(theme, "primary"),
140        iconWidth: 12,
141        buttonWidth: 24,
142        cornerRadius: 6,
143        hover: {
144          color: iconColor(theme, "active"),
145          background: backgroundColor(theme, "on500", "hovered"),
146        },
147        disabled: {
148          color: withOpacity(iconColor(theme, "muted"), 0.6),
149        },
150      },
151      padding: { left: 8, right: 8, top: 4, bottom: 4 },
152    },
153    breadcrumbs: {
154      ...text(theme, "mono", "secondary"),
155      padding: { left: 6 },
156    },
157    disconnectedOverlay: {
158      ...text(theme, "sans", "active"),
159      background: withOpacity(theme.backgroundColor[500].base, 0.8),
160    },
161    notification: {
162      margin: { top: 10 },
163      background: backgroundColor(theme, 300),
164      cornerRadius: 6,
165      padding: 12,
166      border: border(theme, "primary"),
167      shadow: modalShadow(theme),
168    },
169    notifications: {
170      width: 400,
171      margin: { right: 10, bottom: 10 },
172    },
173    dock: {
174      initialSizeRight: 640,
175      initialSizeBottom: 480,
176      wash_color: withOpacity(theme.backgroundColor[500].base, 0.5),
177      panel: {
178        border: {
179          ...border(theme, "secondary"),
180          width: 1
181        },
182      },
183      maximized: {
184        margin: 24,
185        border: border(theme, "secondary", { "overlay": true }),
186        shadow: modalShadow(theme),
187      }
188    }
189  };
190}