@sanity/dashboard 2.29.5-get-started-template.13 → 2.29.5-purple-unicorn.779
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{DashboardTool.js → cjs/DashboardTool.js} +3 -3
- package/lib/{components → cjs/components}/DashboardLayout.js +0 -0
- package/lib/{components → cjs/components}/NotFoundWidget.js +5 -3
- package/lib/{components → cjs/components}/WidgetGroup.js +14 -10
- package/lib/{components → cjs/components}/dashboardWidget.js +14 -10
- package/lib/{containers → cjs/containers}/Dashboard.js +1 -1
- package/lib/cjs/containers/WidgetContainer.js +52 -0
- package/lib/{dashboardConfig.js → cjs/dashboardConfig.js} +0 -0
- package/lib/{legacyParts.js → cjs/legacyParts.js} +6 -6
- package/lib/{versionedClient.js → cjs/versionedClient.js} +1 -1
- package/lib/{widget.css → cjs/widget.css} +0 -0
- package/lib/{widgets → cjs/widgets}/projectInfo/ProjectInfo.js +20 -16
- package/lib/{widgets → cjs/widgets}/projectInfo/index.js +0 -0
- package/lib/{widgets → cjs/widgets}/projectUsers/ProjectUsers.js +25 -19
- package/lib/{widgets → cjs/widgets}/projectUsers/index.js +0 -0
- package/lib/{widgets → cjs/widgets}/sanityTutorials/SanityTutorials.js +16 -9
- package/lib/{widgets → cjs/widgets}/sanityTutorials/Tutorial.js +15 -12
- package/lib/{widgets → cjs/widgets}/sanityTutorials/dataAdapter.js +2 -2
- package/lib/{widgets → cjs/widgets}/sanityTutorials/index.js +0 -0
- package/lib/esm/DashboardTool.js +33 -0
- package/lib/esm/components/DashboardLayout.js +23 -0
- package/lib/esm/components/NotFoundWidget.js +39 -0
- package/lib/esm/components/WidgetGroup.js +54 -0
- package/lib/esm/components/dashboardWidget.js +38 -0
- package/lib/esm/containers/Dashboard.js +19 -0
- package/lib/esm/containers/WidgetContainer.js +39 -0
- package/lib/esm/dashboardConfig.js +9 -0
- package/lib/esm/legacyParts.js +9 -0
- package/lib/esm/versionedClient.js +11 -0
- package/lib/esm/widget.css +62 -0
- package/lib/esm/widgets/projectInfo/ProjectInfo.js +254 -0
- package/lib/esm/widgets/projectInfo/index.js +8 -0
- package/lib/esm/widgets/projectUsers/ProjectUsers.js +174 -0
- package/lib/esm/widgets/projectUsers/index.js +5 -0
- package/lib/esm/widgets/sanityTutorials/SanityTutorials.js +108 -0
- package/lib/esm/widgets/sanityTutorials/Tutorial.js +98 -0
- package/lib/esm/widgets/sanityTutorials/dataAdapter.js +16 -0
- package/lib/esm/widgets/sanityTutorials/index.js +8 -0
- package/package.json +15 -11
- package/src/DashboardTool.js +32 -0
- package/src/components/DashboardLayout.js +22 -0
- package/src/components/NotFoundWidget.js +41 -0
- package/src/components/WidgetGroup.js +97 -0
- package/src/components/dashboardWidget.tsx +70 -0
- package/src/containers/Dashboard.js +20 -0
- package/src/containers/WidgetContainer.js +52 -0
- package/src/dashboardConfig.js +3 -0
- package/src/legacyParts.ts +11 -0
- package/src/versionedClient.js +9 -0
- package/src/widget.css +62 -0
- package/src/widgets/projectInfo/ProjectInfo.js +232 -0
- package/src/widgets/projectInfo/index.js +7 -0
- package/src/widgets/projectUsers/ProjectUsers.js +179 -0
- package/src/widgets/projectUsers/index.js +6 -0
- package/src/widgets/sanityTutorials/SanityTutorials.js +91 -0
- package/src/widgets/sanityTutorials/Tutorial.js +120 -0
- package/src/widgets/sanityTutorials/dataAdapter.js +17 -0
- package/src/widgets/sanityTutorials/index.js +7 -0
- package/.babelrc +0 -4
- package/lib/containers/WidgetContainer.js +0 -56
- package/tsconfig.json +0 -17
|
@@ -18,7 +18,7 @@ Object.keys(_dashboardWidget).forEach(function (key) {
|
|
|
18
18
|
if (key in exports && exports[key] === _dashboardWidget[key]) return;
|
|
19
19
|
Object.defineProperty(exports, key, {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _dashboardWidget[key];
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -26,12 +26,12 @@ Object.keys(_dashboardWidget).forEach(function (key) {
|
|
|
26
26
|
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const strokeStyle = {
|
|
30
30
|
stroke: 'currentColor',
|
|
31
31
|
strokeWidth: 1.2
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const DashboardIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
35
35
|
"data-sanity-icon": true,
|
|
36
36
|
viewBox: "0 0 25 25",
|
|
37
37
|
fill: "none",
|
|
File without changes
|
|
@@ -19,11 +19,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
|
|
20
20
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const Root = (0, _styledComponents.default)(_ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n"])));
|
|
23
23
|
|
|
24
24
|
function NotFoundWidget(props) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const {
|
|
26
|
+
title,
|
|
27
|
+
children
|
|
28
|
+
} = props;
|
|
27
29
|
return /*#__PURE__*/_react.default.createElement(Root, {
|
|
28
30
|
radius: 3,
|
|
29
31
|
paddingX: 3,
|
|
@@ -15,7 +15,7 @@ var _legacyParts = require("../legacyParts");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
17
17
|
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
@@ -23,26 +23,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
small: function
|
|
26
|
+
const media = {
|
|
27
|
+
small: function () {
|
|
28
28
|
return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref => {
|
|
29
|
-
|
|
29
|
+
let {
|
|
30
|
+
theme
|
|
31
|
+
} = _ref;
|
|
30
32
|
return theme.sanity.media[0];
|
|
31
33
|
}, (0, _styledComponents.css)(...arguments));
|
|
32
34
|
},
|
|
33
|
-
medium: function
|
|
35
|
+
medium: function () {
|
|
34
36
|
return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref2 => {
|
|
35
|
-
|
|
37
|
+
let {
|
|
38
|
+
theme
|
|
39
|
+
} = _ref2;
|
|
36
40
|
return theme.sanity.media[2];
|
|
37
41
|
}, (0, _styledComponents.css)(...arguments));
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
|
-
|
|
44
|
+
const Root = (0, _styledComponents.default)(_ui.Grid)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n\n & > div {\n overflow: hidden;\n }\n\n & > div[data-width='medium'] {\n ", "\n }\n\n & > div[data-width='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-width='full'] {\n ", "\n }\n\n & > div[data-height='medium'] {\n ", "\n }\n\n & > div[data-height='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-height='full'] {\n ", "\n }\n"])), media.small(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.small(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.medium(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n grid-column: span 3;\n "]))), media.small(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n grid-column: 1 / -1;\n "]))), media.small(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.small(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.medium(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n grid-row: span 3;\n "]))), media.medium(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n grid-row: 1 / -1;\n "]))));
|
|
41
45
|
|
|
42
46
|
function WidgetGroup(props) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
const config = props.config || {};
|
|
48
|
+
const widgets = config.widgets || [];
|
|
49
|
+
const layout = config.layout || {};
|
|
46
50
|
return /*#__PURE__*/_react.default.createElement(Root, {
|
|
47
51
|
autoFlow: "dense",
|
|
48
52
|
"data-width": layout.width || 'auto',
|
|
@@ -15,23 +15,27 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
22
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const Root = (0, _styledComponents.default)(_ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n box-sizing: border-box;\n position: relative;\n"])));
|
|
25
|
+
const Header = (0, _styledComponents.default)(_ui.Card)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: sticky;\n top: 0;\n z-index: 2;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n"])));
|
|
26
|
+
const Footer = (0, _styledComponents.default)(_ui.Card)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: sticky;\n overflow: hidden;\n bottom: 0;\n z-index: 2;\n border-bottom-right-radius: inherit;\n border-bottom-left-radius: inherit;\n margin-top: auto;\n"])));
|
|
27
|
+
const Content = (0, _styledComponents.default)(_ui.Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n height: stretch;\n min-height: 21.5em;\n\n @media (min-width: ", "px) {\n overflow-y: auto;\n outline: none;\n }\n"])), _ref => {
|
|
28
|
+
let {
|
|
29
|
+
theme
|
|
30
|
+
} = _ref;
|
|
29
31
|
return theme.sanity.media[0];
|
|
30
32
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const DashboardWidget = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
34
|
+
const {
|
|
35
|
+
header,
|
|
36
|
+
children,
|
|
37
|
+
footer
|
|
38
|
+
} = props;
|
|
35
39
|
return /*#__PURE__*/_react.default.createElement(Root, {
|
|
36
40
|
radius: 3,
|
|
37
41
|
display: "flex",
|
|
@@ -20,7 +20,7 @@ function Dashboard() {
|
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const widgetConfigs = _legacyParts.dashboardConfig.widgets || [];
|
|
24
24
|
return /*#__PURE__*/_react.default.createElement(_DashboardLayout.default, null, /*#__PURE__*/_react.default.createElement(_WidgetGroup.default, {
|
|
25
25
|
config: {
|
|
26
26
|
widgets: widgetConfigs
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _NotFoundWidget = _interopRequireDefault(require("../components/NotFoundWidget"));
|
|
13
|
+
|
|
14
|
+
var _legacyParts = require("../legacyParts");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function WidgetContainer(props) {
|
|
19
|
+
const config = props.config || {};
|
|
20
|
+
const definition = Array.isArray(_legacyParts.definitions) ? _legacyParts.definitions.find(wid => wid.name === config.name) : null;
|
|
21
|
+
|
|
22
|
+
if (definition) {
|
|
23
|
+
const options = { ...(definition.options || {}),
|
|
24
|
+
...(config.options || {})
|
|
25
|
+
};
|
|
26
|
+
const layout = { ...(definition.layout || {}),
|
|
27
|
+
...(config.layout || {})
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
"data-width": layout.width,
|
|
31
|
+
"data-height": layout.height
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(definition.component, options));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const layout = config.layout || {};
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
+
"data-width": layout.width,
|
|
38
|
+
"data-height": layout.height
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_NotFoundWidget.default, {
|
|
40
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Not found: \"", config.name, "\"")
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "Make sure your ", /*#__PURE__*/_react.default.createElement("code", null, "sanity.json"), " file mentions such a widget and that it\u2019s an implementation of ", /*#__PURE__*/_react.default.createElement("code", null, "part:@sanity/dashboard/widget"), ".")));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
WidgetContainer.propTypes = {
|
|
45
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
46
|
+
config: _propTypes.default.any
|
|
47
|
+
};
|
|
48
|
+
WidgetContainer.defaultProps = {
|
|
49
|
+
config: null
|
|
50
|
+
};
|
|
51
|
+
var _default = WidgetContainer;
|
|
52
|
+
exports.default = _default;
|
|
File without changes
|
|
@@ -5,37 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "DefaultPreview", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _default.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "WidgetContainer", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _widgetContainer.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "dashboardConfig", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function
|
|
20
|
+
get: function () {
|
|
21
21
|
return _config.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "definitions", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function
|
|
26
|
+
get: function () {
|
|
27
27
|
return _widget.default;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "sanityClient", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function
|
|
32
|
+
get: function () {
|
|
33
33
|
return _client.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "userStore", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function
|
|
38
|
+
get: function () {
|
|
39
39
|
return _user.default;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
File without changes
|
|
@@ -23,9 +23,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const {
|
|
27
|
+
projectId,
|
|
28
|
+
dataset
|
|
29
|
+
} = _versionedClient.versionedClient.config();
|
|
29
30
|
|
|
30
31
|
function isUrl(url) {
|
|
31
32
|
return /^https?:\/\//.test("".concat(url));
|
|
@@ -60,13 +61,15 @@ class ProjectInfo extends _react.default.PureComponent {
|
|
|
60
61
|
uri: "/projects/".concat(projectId)
|
|
61
62
|
}).subscribe({
|
|
62
63
|
next: result => {
|
|
63
|
-
|
|
64
|
+
const {
|
|
65
|
+
studioHost
|
|
66
|
+
} = result;
|
|
64
67
|
this.setState({
|
|
65
68
|
studioHost: studioHost ? "https://".concat(studioHost, ".sanity.studio") : null
|
|
66
69
|
});
|
|
67
70
|
},
|
|
68
|
-
error:
|
|
69
|
-
console.log('Error while looking for studioHost',
|
|
71
|
+
error: error => {
|
|
72
|
+
console.log('Error while looking for studioHost', error);
|
|
70
73
|
this.setState({
|
|
71
74
|
studioHost: {
|
|
72
75
|
error: 'Something went wrong while looking up studioHost. See console.'
|
|
@@ -82,13 +85,13 @@ class ProjectInfo extends _react.default.PureComponent {
|
|
|
82
85
|
next: () => this.setState({
|
|
83
86
|
graphqlApi: getGraphQlUrl()
|
|
84
87
|
}),
|
|
85
|
-
error:
|
|
86
|
-
if (
|
|
88
|
+
error: error => {
|
|
89
|
+
if (error.statusCode === 404) {
|
|
87
90
|
this.setState({
|
|
88
91
|
graphqlApi: null
|
|
89
92
|
});
|
|
90
93
|
} else {
|
|
91
|
-
console.log('Error while looking for graphqlApi',
|
|
94
|
+
console.log('Error while looking for graphqlApi', error);
|
|
92
95
|
this.setState({
|
|
93
96
|
graphqlApi: {
|
|
94
97
|
error: 'Something went wrong while looking up graphqlApi. See console.'
|
|
@@ -104,11 +107,12 @@ class ProjectInfo extends _react.default.PureComponent {
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
assembleTableRows() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const {
|
|
111
|
+
graphqlApi,
|
|
112
|
+
studioHost
|
|
113
|
+
} = this.state;
|
|
114
|
+
const propsData = this.props.data;
|
|
115
|
+
let result = [{
|
|
112
116
|
title: 'Sanity project',
|
|
113
117
|
rows: [{
|
|
114
118
|
title: 'Project ID',
|
|
@@ -119,7 +123,7 @@ class ProjectInfo extends _react.default.PureComponent {
|
|
|
119
123
|
}]
|
|
120
124
|
}]; // Handle any apps
|
|
121
125
|
|
|
122
|
-
|
|
126
|
+
const apps = [studioHost ? {
|
|
123
127
|
title: 'Studio',
|
|
124
128
|
value: studioHost
|
|
125
129
|
} : null].concat(propsData.filter(item => item.category === 'apps')).filter(Boolean);
|
|
@@ -143,7 +147,7 @@ class ProjectInfo extends _react.default.PureComponent {
|
|
|
143
147
|
}]
|
|
144
148
|
}], propsData.filter(item => item.category === 'apis')); // Handle whatever else there might be
|
|
145
149
|
|
|
146
|
-
|
|
150
|
+
const otherStuff = {};
|
|
147
151
|
propsData.forEach(item => {
|
|
148
152
|
if (item.category !== 'apps' && item.category !== 'apis') {
|
|
149
153
|
if (!otherStuff[item.category]) {
|
|
File without changes
|
|
@@ -15,7 +15,7 @@ var _icons = require("@sanity/icons");
|
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _base = require("@sanity/base");
|
|
19
19
|
|
|
20
20
|
var _versionedClient = require("../../versionedClient");
|
|
21
21
|
|
|
@@ -31,16 +31,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
31
31
|
|
|
32
32
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const AvatarWrapper = (0, _styledComponents.default)(_ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n border-radius: 50%;\n border-color: transparent;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n & > img {\n width: 100%;\n height: auto;\n }\n"])));
|
|
35
35
|
|
|
36
36
|
function getInviteUrl(projectId) {
|
|
37
37
|
return "https://manage.sanity.io/projects/".concat(projectId, "/team/invite");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function sortUsersByRobotStatus(userA, userB, project) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const {
|
|
42
|
+
members
|
|
43
|
+
} = project;
|
|
44
|
+
const membershipA = members.find(member => member.id === userA.id);
|
|
45
|
+
const membershipB = members.find(member => member.id === userB.id);
|
|
44
46
|
|
|
45
47
|
if (membershipA.isRobot) {
|
|
46
48
|
return 1;
|
|
@@ -83,8 +85,9 @@ class ProjectUsers extends _react.default.PureComponent {
|
|
|
83
85
|
this.subscription.unsubscribe();
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
const {
|
|
89
|
+
projectId
|
|
90
|
+
} = _versionedClient.versionedClient.config();
|
|
88
91
|
|
|
89
92
|
this.subscription = _versionedClient.versionedClient.observable.request({
|
|
90
93
|
uri: "/projects/".concat(projectId)
|
|
@@ -93,25 +96,28 @@ class ProjectUsers extends _react.default.PureComponent {
|
|
|
93
96
|
users
|
|
94
97
|
}))))).subscribe({
|
|
95
98
|
next: _ref => {
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
let {
|
|
100
|
+
users,
|
|
101
|
+
project
|
|
102
|
+
} = _ref;
|
|
98
103
|
return this.setState({
|
|
99
104
|
project,
|
|
100
105
|
users: (Array.isArray(users) ? users : [users]).sort((userA, userB) => sortUsersByRobotStatus(userA, userB, project))
|
|
101
106
|
});
|
|
102
107
|
},
|
|
103
|
-
error:
|
|
104
|
-
error
|
|
108
|
+
error: error => this.setState({
|
|
109
|
+
error
|
|
105
110
|
})
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
render() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
const {
|
|
116
|
+
error,
|
|
117
|
+
project,
|
|
118
|
+
users
|
|
119
|
+
} = this.state;
|
|
120
|
+
const isLoading = !users || !project;
|
|
115
121
|
|
|
116
122
|
if (error) {
|
|
117
123
|
return /*#__PURE__*/_react.default.createElement(_DashboardTool.DashboardWidget, {
|
|
@@ -159,8 +165,8 @@ class ProjectUsers extends _react.default.PureComponent {
|
|
|
159
165
|
space: 3,
|
|
160
166
|
padding: 3
|
|
161
167
|
}, users.map(user => {
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
const membership = project.members.find(member => member.id === user.id);
|
|
169
|
+
const media = membership.isRobot ? /*#__PURE__*/_react.default.createElement(_ui.Text, {
|
|
164
170
|
size: 3
|
|
165
171
|
}, /*#__PURE__*/_react.default.createElement(_icons.RobotIcon, null)) : /*#__PURE__*/_react.default.createElement(AvatarWrapper, {
|
|
166
172
|
tone: "transparent"
|
|
@@ -170,7 +176,7 @@ class ProjectUsers extends _react.default.PureComponent {
|
|
|
170
176
|
}));
|
|
171
177
|
return /*#__PURE__*/_react.default.createElement(_ui.Box, {
|
|
172
178
|
key: user.id
|
|
173
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_base.DefaultPreview, {
|
|
174
180
|
title: user.displayName,
|
|
175
181
|
subtitle: membership.role,
|
|
176
182
|
media: media
|
|
File without changes
|
|
@@ -23,8 +23,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const {
|
|
27
|
+
urlBuilder,
|
|
28
|
+
getFeed
|
|
29
|
+
} = _dataAdapter.default;
|
|
28
30
|
|
|
29
31
|
function createUrl(slug, type) {
|
|
30
32
|
if (type === 'tutorial') {
|
|
@@ -46,7 +48,9 @@ class SanityTutorials extends _react.default.Component {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
componentDidMount() {
|
|
49
|
-
|
|
51
|
+
const {
|
|
52
|
+
templateRepoId
|
|
53
|
+
} = this.props;
|
|
50
54
|
this.subscription = getFeed(templateRepoId).subscribe(response => {
|
|
51
55
|
this.setState({
|
|
52
56
|
feedItems: response.items
|
|
@@ -61,8 +65,10 @@ class SanityTutorials extends _react.default.Component {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
render() {
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
const {
|
|
69
|
+
feedItems
|
|
70
|
+
} = this.state;
|
|
71
|
+
const title = 'Learn about Sanity';
|
|
66
72
|
return /*#__PURE__*/_react.default.createElement(_DashboardTool.DashboardWidget, {
|
|
67
73
|
header: title
|
|
68
74
|
}, /*#__PURE__*/_react.default.createElement(_ui.Flex, {
|
|
@@ -75,10 +81,11 @@ class SanityTutorials extends _react.default.Component {
|
|
|
75
81
|
return null;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
const presenter = feedItem.presenter || (0, _get2.default)(feedItem, 'guideOrTutorial.presenter') || {};
|
|
85
|
+
const subtitle = (0, _get2.default)(feedItem, 'category');
|
|
86
|
+
const {
|
|
87
|
+
guideOrTutorial = {}
|
|
88
|
+
} = feedItem;
|
|
82
89
|
return /*#__PURE__*/_react.default.createElement(_ui.Flex, {
|
|
83
90
|
as: "li",
|
|
84
91
|
key: feedItem._id,
|
|
@@ -23,24 +23,27 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
23
23
|
|
|
24
24
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const PlayIconBox = (0, _styledComponents.default)(_ui.Box)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 2.75em;\n height: 2.75em;\n border-radius: 50%;\n background: ", ";\n opacity: 0.75;\n }\n"])), _ref => {
|
|
27
|
+
let {
|
|
28
|
+
theme
|
|
29
|
+
} = _ref;
|
|
28
30
|
return theme.sanity.color.card.enabled.bg;
|
|
29
31
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const Root = (0, _styledComponents.default)(_ui.Flex)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:hover {\n ", " {\n &:before {\n opacity: 1;\n }\n }\n }\n"])), PlayIconBox);
|
|
33
|
+
const PosterCard = (0, _styledComponents.default)(_ui.Card)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n padding-bottom: calc(9 / 16 * 100%);\n position: relative;\n"])));
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
const Poster = _styledComponents.default.img(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n object-fit: cover;\n display: block;\n\n &:not([src]) {\n display: none;\n }\n"])));
|
|
34
36
|
|
|
35
37
|
class Tutorial extends _react.default.PureComponent {
|
|
36
38
|
render() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
const {
|
|
40
|
+
title,
|
|
41
|
+
posterURL,
|
|
42
|
+
showPlayIcon,
|
|
43
|
+
href,
|
|
44
|
+
presenterName,
|
|
45
|
+
presenterSubtitle
|
|
46
|
+
} = this.props;
|
|
44
47
|
return /*#__PURE__*/_react.default.createElement(Root, {
|
|
45
48
|
flex: 1
|
|
46
49
|
}, /*#__PURE__*/_react.default.createElement(_ui.Card, {
|
|
@@ -11,13 +11,13 @@ var _versionedClient = require("../../versionedClient");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const tutorialsProjectConfig = {
|
|
15
15
|
projectId: '3do82whm',
|
|
16
16
|
dataset: 'next'
|
|
17
17
|
};
|
|
18
18
|
var _default = {
|
|
19
19
|
getFeed: templateRepoId => {
|
|
20
|
-
|
|
20
|
+
const uri = templateRepoId ? "/addons/dashboard?templateRepoId=".concat(templateRepoId) : '/addons/dashboard';
|
|
21
21
|
return _versionedClient.versionedClient.observable.request({
|
|
22
22
|
uri,
|
|
23
23
|
withCredentials: false
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Dashboard from './containers/Dashboard';
|
|
3
|
+
const strokeStyle = {
|
|
4
|
+
stroke: 'currentColor',
|
|
5
|
+
strokeWidth: 1.2
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const DashboardIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
"data-sanity-icon": true,
|
|
10
|
+
viewBox: "0 0 25 25",
|
|
11
|
+
fill: "none",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
preserveAspectRatio: "xMidYMid",
|
|
14
|
+
width: "1em",
|
|
15
|
+
height: "1em"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
|
|
18
|
+
style: strokeStyle
|
|
19
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
d: "M5.5 12.5H19.5",
|
|
21
|
+
style: strokeStyle
|
|
22
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M14.5 19.5V12.5M10.5 12.5V5.5",
|
|
24
|
+
style: strokeStyle
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export * from './components/dashboardWidget';
|
|
28
|
+
export default {
|
|
29
|
+
title: 'Dashboard',
|
|
30
|
+
name: 'dashboard',
|
|
31
|
+
icon: DashboardIcon,
|
|
32
|
+
component: Dashboard
|
|
33
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Container } from '@sanity/ui';
|
|
4
|
+
|
|
5
|
+
function DashboardLayout(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
7
|
+
width: 4,
|
|
8
|
+
padding: 4,
|
|
9
|
+
sizing: "border",
|
|
10
|
+
style: {
|
|
11
|
+
minHeight: '100%'
|
|
12
|
+
}
|
|
13
|
+
}, props.children);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
DashboardLayout.propTypes = {
|
|
17
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
18
|
+
children: PropTypes.any
|
|
19
|
+
};
|
|
20
|
+
DashboardLayout.defaultProps = {
|
|
21
|
+
children: 'Dummy'
|
|
22
|
+
};
|
|
23
|
+
export default DashboardLayout;
|