update frontend pages api (#1520)
Signed-off-by: zzjin <tczzjin@gmail.com> Signed-off-by: zzjin <tczzjin@gmail.com>
@@ -1,38 +1,20 @@
|
||||
// .prettierrc.js
|
||||
module.exports = {
|
||||
// 一行最多 100 字符
|
||||
printWidth: 100,
|
||||
// 使用 4 个空格缩进
|
||||
tabWidth: 2,
|
||||
// 不使用缩进符,而使用空格
|
||||
useTabs: false,
|
||||
// 行尾需要有分号
|
||||
semi: true,
|
||||
// 使用单引号
|
||||
singleQuote: true,
|
||||
// 对象的 key 仅在必要时用引号
|
||||
quoteProps: 'as-needed',
|
||||
// jsx 不使用单引号,而使用双引号
|
||||
jsxSingleQuote: false,
|
||||
// 末尾不需要逗号
|
||||
trailingComma: 'none',
|
||||
// 大括号内的首尾需要空格
|
||||
bracketSpacing: true,
|
||||
// jsx 标签的反尖括号需要换行
|
||||
jsxBracketSameLine: false,
|
||||
// 箭头函数,只有一个参数的时候,也需要括号
|
||||
arrowParens: 'always',
|
||||
// 每个文件格式化的范围是文件的全部内容
|
||||
rangeStart: 0,
|
||||
rangeEnd: Infinity,
|
||||
// 不需要写文件开头的 @prettier
|
||||
requirePragma: false,
|
||||
// 不需要自动在文件开头插入 @prettier
|
||||
insertPragma: false,
|
||||
// 使用默认的折行标准
|
||||
proseWrap: 'preserve',
|
||||
// 根据显示样式决定 html 要不要折行
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
// 换行符使用 lf
|
||||
endOfLine: 'lf'
|
||||
};
|
||||
|
||||
@@ -7,6 +7,21 @@ const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
output: 'standalone',
|
||||
}
|
||||
webpack(config) {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/i,
|
||||
issuer: /\.[jt]sx?$/,
|
||||
use: ['@svgr/webpack']
|
||||
});
|
||||
|
||||
module.exports = nextConfig
|
||||
return config;
|
||||
},
|
||||
experimental: {
|
||||
images: {
|
||||
allowFutureImage: true
|
||||
},
|
||||
newNextLinkBehavior: true
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
|
||||
@@ -8,19 +8,26 @@
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"browserslist": [
|
||||
"defaults",
|
||||
"not ie 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
"antd": "4.22.3",
|
||||
"@nextui-org/react": "^1.0.0-beta.9",
|
||||
"clsx": "^1.2.1",
|
||||
"next": "12.2.4",
|
||||
"next-themes": "^0.2.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.6.4",
|
||||
"@types/react": "18.0.15",
|
||||
"@svgr/webpack": "^6.3.1",
|
||||
"@types/node": "18.7.1",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "18.0.6",
|
||||
"eslint": "8.21.0",
|
||||
"eslint-config-next": "12.2.4",
|
||||
"typescript": "4.7.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="60" viewBox="0 0 9.252 4.626">
|
||||
<g transform="matrix(.037376 0 0 .037376 1.069994 -1.319339)" fill-rule="evenodd">
|
||||
<path
|
||||
d="M8.504 128.215h5.8v-22.977l9.058 20.033c1.026 2.408 2.5 3.3 5.354 3.3s4.24-.893 5.3-3.3l9.013-20.033v22.977h5.845v-22.977c0-2.23-.893-3.303-2.767-3.883-4.417-1.338-7.362-.178-8.7 2.81l-8.878 19.81-8.567-19.81c-1.294-2.988-4.284-4.148-8.745-2.81-1.83.58-2.722 1.652-2.722 3.883l-.001 22.977zm45.198-18.694h5.845v12.627c-.044.713.223 2.32 3.4 2.363 1.65.045 12.582 0 12.67 0v-15.08h5.845v20.658c0 5.086-6.3 6.2-9.236 6.246h-18.38v-3.88h18.427c3.748-.402 3.302-2.275 3.302-2.9v-1.518h-12.36c-5.756-.045-9.46-2.588-9.503-5.488v-13.03zm125.374-14.635c-3.568-.09-6.336.268-8.656 1.25-.668.27-1.74.27-1.828 1.116.357.355.4.936.713 1.428.535.893 1.473 2.096 2.32 2.72.938.715 1.875 1.428 2.855 2.053 1.74 1.07 3.703 1.695 5.398 2.766.982.625 1.963 1.428 2.945 2.098.5.357.803.938 1.428 1.16v-.135c-.312-.4-.402-.98-.713-1.428-.447-.445-.893-.848-1.34-1.293-1.293-1.74-2.9-3.258-4.64-4.506-1.428-.982-4.55-2.32-5.13-3.97l-.088-.09c.98-.09 2.14-.447 3.078-.715 1.518-.4 2.9-.312 4.46-.713.715-.18 1.428-.402 2.143-.625v-.4c-.803-.803-1.383-1.874-2.23-2.632-2.275-1.963-4.775-3.882-7.363-5.488-1.383-.892-3.168-1.473-4.64-2.23-.537-.268-1.428-.402-1.74-.848-.805-.98-1.25-2.275-1.83-3.436-1.293-2.454-2.543-5.175-3.658-7.763-.803-1.74-1.295-3.48-2.275-5.086-4.596-7.585-9.594-12.18-17.268-16.687-1.65-.937-3.613-1.34-5.7-1.83l-3.346-.18c-.715-.312-1.428-1.16-2.053-1.562-2.543-1.606-9.102-5.086-10.977-.49-1.205 2.9 1.785 5.755 2.8 7.228.76 1.026 1.74 2.186 2.277 3.346.3.758.4 1.562.713 2.365.713 1.963 1.383 4.15 2.32 5.98.5.937 1.025 1.92 1.65 2.767.357.49.982.714 1.115 1.517-.625.893-.668 2.23-1.025 3.347-1.607 5.042-.982 11.288 1.293 14.99.715 1.115 2.4 3.57 4.686 2.632 2.008-.803 1.56-3.346 2.14-5.577.135-.535.045-.892.312-1.25v.09l1.83 3.703c1.383 2.186 3.793 4.462 5.8 5.98 1.07.803 1.918 2.187 3.256 2.677v-.135h-.088c-.268-.4-.67-.58-1.027-.892-.803-.803-1.695-1.785-2.32-2.677-1.873-2.498-3.523-5.265-4.996-8.12-.715-1.383-1.34-2.9-1.918-4.283-.27-.536-.27-1.34-.715-1.606-.67.98-1.65 1.83-2.143 3.034-.848 1.918-.936 4.283-1.248 6.737-.18.045-.1 0-.18.09-1.426-.356-1.918-1.83-2.453-3.078-1.338-3.168-1.562-8.254-.402-11.913.312-.937 1.652-3.882 1.117-4.774-.27-.848-1.16-1.338-1.652-2.008-.58-.848-1.203-1.918-1.605-2.855-1.07-2.5-1.605-5.265-2.766-7.764-.537-1.16-1.473-2.365-2.232-3.435-.848-1.205-1.783-2.053-2.453-3.48-.223-.49-.535-1.294-.178-1.83.088-.357.268-.49.623-.58.58-.49 2.232.134 2.812.4 1.65.67 3.033 1.294 4.416 2.23.625.446 1.295 1.294 2.098 1.518h.938c1.428.312 3.033.09 4.37.49 2.365.76 4.506 1.874 6.426 3.08 5.844 3.703 10.664 8.968 13.92 15.26.535 1.026.758 1.963 1.25 3.034.938 2.187 2.098 4.417 3.033 6.56.938 2.097 1.83 4.24 3.168 5.98.67.937 3.346 1.427 4.55 1.918.893.4 2.275.76 3.08 1.25 1.516.937 3.033 2.008 4.46 3.034.713.534 2.945 1.65 3.078 2.54zm-45.5-38.772a7.09 7.09 0 0 0-1.828.223v.09h.088c.357.714.982 1.205 1.428 1.83l1.027 2.142.088-.09c.625-.446.938-1.16.938-2.23-.268-.312-.312-.625-.535-.937-.268-.446-.848-.67-1.206-1.026z"
|
||||
fill="#00678c" />
|
||||
<path
|
||||
d="M85.916 128.215h16.776c1.963 0 3.838-.4 5.354-1.115 2.543-1.16 3.748-2.72 3.748-4.773v-4.283c0-1.65-1.383-3.213-4.148-4.283-1.428-.535-3.213-.848-4.953-.848h-7.05c-2.365 0-3.48-.715-3.793-2.275-.044-.178-.044-.357-.044-.535v-2.633c0-.135 0-.312.044-.49.312-1.205.937-1.518 3-1.74h17.177v-3.883h-16.33c-2.365 0-3.614.135-4.73.492-3.436 1.07-4.953 2.766-4.953 5.754v3.393c0 2.63 2.945 4.863 7.942 5.398.535.045 1.115.045 1.695.045h6.024c.223 0 .445 0 .623.045 1.83.178 2.633.49 3.168 1.158.357.357.447.67.447 1.072v3.39c0 .4-.268.938-.803 1.383s-1.385.758-2.5.803c-.223 0-.355.045-.58.045H85.916zm62.195-6.736c0 3.97 3 6.2 8.97 6.648.58.045 1.115.088 1.695.088h15.17v-3.88h-15.303c-3.393 0-4.686-.848-4.686-2.9v-20.078H148.1v20.123zm-32.615.177v-13.83c0-3.525 2.498-5.668 7.363-6.336.535-.045 1.07-.09 1.56-.09h11.064c.58 0 1.072.045 1.652.09 4.863.668 7.316 2.81 7.316 6.336v13.83c0 2.855-1.025 4.373-3.436 5.4l5.71 5.174h-6.736l-4.64-4.193-4.686.268h-6.246a13.66 13.66 0 0 1-3.391-.445c-3.7-1.028-5.53-2.99-5.53-6.204zm6.29-.31c0 .178.1.355.135.58.312 1.605 1.828 2.498 4.148 2.498h5.266l-4.818-4.373h6.736l4.238 3.838c.805-.447 1.295-1.072 1.473-1.875.045-.178.045-.4.045-.58v-13.252c0-.178 0-.355-.045-.535-.312-1.516-1.828-2.363-4.104-2.363h-8.79c-2.588 0-4.283 1.115-4.283 2.898z"
|
||||
fill="#ce8b2c" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,26 @@
|
||||
<svg width="256px" height="256px" viewBox="0 -18 256 256" xmlns="http://www.w3.org/2000/svg"
|
||||
preserveAspectRatio="xMinYMin meet">
|
||||
<path
|
||||
d="M245.97 168.943c-13.662 7.121-84.434 36.22-99.501 44.075-15.067 7.856-23.437 7.78-35.34 2.09-11.902-5.69-87.216-36.112-100.783-42.597C3.566 169.271 0 166.535 0 163.951v-25.876s98.05-21.345 113.879-27.024c15.828-5.679 21.32-5.884 34.79-.95 13.472 4.936 94.018 19.468 107.331 24.344l-.006 25.51c.002 2.558-3.07 5.364-10.024 8.988"
|
||||
fill="#912626" />
|
||||
<path
|
||||
d="M245.965 143.22c-13.661 7.118-84.431 36.218-99.498 44.072-15.066 7.857-23.436 7.78-35.338 2.09-11.903-5.686-87.214-36.113-100.78-42.594-13.566-6.485-13.85-10.948-.524-16.166 13.326-5.22 88.224-34.605 104.055-40.284 15.828-5.677 21.319-5.884 34.789-.948 13.471 4.934 83.819 32.935 97.13 37.81 13.316 4.881 13.827 8.9.166 16.02"
|
||||
fill="#C6302B" />
|
||||
<path
|
||||
d="M245.97 127.074c-13.662 7.122-84.434 36.22-99.501 44.078-15.067 7.853-23.437 7.777-35.34 2.087-11.903-5.687-87.216-36.112-100.783-42.597C3.566 127.402 0 124.67 0 122.085V96.206s98.05-21.344 113.879-27.023c15.828-5.679 21.32-5.885 34.79-.95C162.142 73.168 242.688 87.697 256 92.574l-.006 25.513c.002 2.557-3.07 5.363-10.024 8.987"
|
||||
fill="#912626" />
|
||||
<path
|
||||
d="M245.965 101.351c-13.661 7.12-84.431 36.218-99.498 44.075-15.066 7.854-23.436 7.777-35.338 2.087-11.903-5.686-87.214-36.112-100.78-42.594-13.566-6.483-13.85-10.947-.524-16.167C23.151 83.535 98.05 54.148 113.88 48.47c15.828-5.678 21.319-5.884 34.789-.949 13.471 4.934 83.819 32.933 97.13 37.81 13.316 4.88 13.827 8.9.166 16.02"
|
||||
fill="#C6302B" />
|
||||
<path
|
||||
d="M245.97 83.653c-13.662 7.12-84.434 36.22-99.501 44.078-15.067 7.854-23.437 7.777-35.34 2.087-11.903-5.687-87.216-36.113-100.783-42.595C3.566 83.98 0 81.247 0 78.665v-25.88s98.05-21.343 113.879-27.021c15.828-5.68 21.32-5.884 34.79-.95C162.142 29.749 242.688 44.278 256 49.155l-.006 25.512c.002 2.555-3.07 5.361-10.024 8.986"
|
||||
fill="#912626" />
|
||||
<path
|
||||
d="M245.965 57.93c-13.661 7.12-84.431 36.22-99.498 44.074-15.066 7.854-23.436 7.777-35.338 2.09C99.227 98.404 23.915 67.98 10.35 61.497-3.217 55.015-3.5 50.55 9.825 45.331 23.151 40.113 98.05 10.73 113.88 5.05c15.828-5.679 21.319-5.883 34.789-.948 13.471 4.935 83.819 32.934 97.13 37.811 13.316 4.876 13.827 8.897.166 16.017"
|
||||
fill="#C6302B" />
|
||||
<path
|
||||
d="M159.283 32.757l-22.01 2.285-4.927 11.856-7.958-13.23-25.415-2.284 18.964-6.839-5.69-10.498 17.755 6.944 16.738-5.48-4.524 10.855 17.067 6.391M131.032 90.275L89.955 73.238l58.86-9.035-17.783 26.072M74.082 39.347c17.375 0 31.46 5.46 31.46 12.194 0 6.736-14.085 12.195-31.46 12.195s-31.46-5.46-31.46-12.195c0-6.734 14.085-12.194 31.46-12.194"
|
||||
fill="#FFF" />
|
||||
<path d="M185.295 35.998l34.836 13.766-34.806 13.753-.03-27.52" fill="#621B1C" />
|
||||
<path d="M146.755 51.243l38.54-15.245.03 27.519-3.779 1.478-34.791-13.752" fill="#9A2928" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-terminal-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M0 3a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm9.5 5.5h-3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm-6.354-.354a.5.5 0 1 0 .708.708l2-2a.5.5 0 0 0 0-.708l-2-2a.5.5 0 1 0-.708.708L4.793 6.5 3.146 8.146z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 377 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bell"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2zM8 1.918l-.797.161A4.002 4.002 0 0 0 4 6c0 .628-.134 2.197-.459 3.742-.16.767-.376 1.566-.663 2.258h10.244c-.287-.692-.502-1.49-.663-2.258C12.134 8.197 12 6.628 12 6a4.002 4.002 0 0 0-3.203-3.92L8 1.917zM14.22 12c.223.447.481.801.78 1H1c.299-.199.557-.553.78-1C2.68 10.2 3 6.88 3 6c0-2.42 1.72-4.44 4.005-4.901a1 1 0 1 1 1.99 0A5.002 5.002 0 0 1 13 6c0 .88.32 4.2 1.22 6z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 558 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-dash-circle-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 238 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-moon-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 422 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 287 B |
@@ -0,0 +1,68 @@
|
||||
<svg id="layout_1" data-name="layout 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 226.77 226.77">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: url(#gradient_595);
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
fill: url(#gradient_230);
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
fill: url(#gradient_588);
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
clip-path: url(#clip-path);
|
||||
}
|
||||
|
||||
.cls-5 {
|
||||
fill: url(#gradient_593);
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="gradient_595" x1="174.65" y1="52.02" x2="46.97" y2="172.04" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#64b0ff" />
|
||||
<stop offset="0.12" stop-color="#43b9ff" />
|
||||
<stop offset="0.28" stop-color="#1fc3ff" />
|
||||
<stop offset="0.42" stop-color="#08c9ff" />
|
||||
<stop offset="0.5" stop-color="#00cbff" />
|
||||
<stop offset="0.57" stop-color="#0cc7ff" />
|
||||
<stop offset="0.71" stop-color="#2dbeff" />
|
||||
<stop offset="0.89" stop-color="#62aeff" />
|
||||
<stop offset="1" stop-color="#85a4ff" />
|
||||
</linearGradient>
|
||||
<linearGradient id="gradient_230" x1="174.65" y1="52.02" x2="46.97" y2="172.04" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#6378ff" />
|
||||
<stop offset="1" stop-color="#6312ff" />
|
||||
</linearGradient>
|
||||
<linearGradient id="gradient_588" x1="11.45" y1="84.91" x2="82.94" y2="62.26" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#948bde" />
|
||||
<stop offset="0.38" stop-color="#57aef4" />
|
||||
<stop offset="0.59" stop-color="#3abfff" />
|
||||
<stop offset="1" stop-color="#00daff" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip-path">
|
||||
<path class="cls-1"
|
||||
d="M183.14,66.16a35.85,35.85,0,0,0-1.89-4.77l0-.1h0a35.06,35.06,0,0,0-66.58,15.34A34.69,34.69,0,0,0,115.4,84v0a.65.65,0,0,1,0,.13c.23,1,.49,2,.8,3A54.1,54.1,0,1,1,10.47,109.91,89.51,89.51,0,1,0,183.14,66.16Z" />
|
||||
</clipPath>
|
||||
<linearGradient id="gradient_593" x1="146.81" y1="36.3" x2="31.88" y2="144.34" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#64acff" />
|
||||
<stop offset="0.13" stop-color="#5cacfe" />
|
||||
<stop offset="0.32" stop-color="#48acfc" />
|
||||
<stop offset="0.5" stop-color="#30acfa" />
|
||||
<stop offset="0.78" stop-color="#179ef4" />
|
||||
<stop offset="1" stop-color="#0091ee" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path class="cls-2"
|
||||
d="M183.14,66.16a35.85,35.85,0,0,0-1.89-4.77l0-.1h0a35.06,35.06,0,0,0-66.58,15.34A34.69,34.69,0,0,0,115.4,84v0a.65.65,0,0,1,0,.13c.23,1,.49,2,.8,3A54.1,54.1,0,1,1,10.47,109.91,89.51,89.51,0,1,0,183.14,66.16Z" />
|
||||
<path class="cls-3"
|
||||
d="M41,96.34c11.58,16.93,35.58,15.36,35.58,15.36-6-5.8-9.87-11.12-10.34-26.17S57.26,66.4,57.26,66.4c15.42-9.66,9.88-20.22,9.41-31.93-.3-7.25,4-12.69,7.38-15.78a76.77,76.77,0,0,0-65,84C10.48,98.85,30.25,80.68,41,96.34Z" />
|
||||
<path class="cls-1"
|
||||
d="M183.14,66.16a35.85,35.85,0,0,0-1.89-4.77l0-.1h0a35.06,35.06,0,0,0-66.58,15.34A34.69,34.69,0,0,0,115.4,84v0a.65.65,0,0,1,0,.13c.23,1,.49,2,.8,3A54.1,54.1,0,1,1,10.47,109.91,89.51,89.51,0,1,0,183.14,66.16Z" />
|
||||
<g class="cls-4">
|
||||
<circle class="cls-5" cx="89.34" cy="90.32" r="78.87" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 338 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-brightness-high-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 807 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle-fill"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 371 B |
@@ -1,9 +1,37 @@
|
||||
import '../styles/globals.css'
|
||||
import type { AppProps } from 'next/app'
|
||||
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
import { createTheme, NextUIProvider } from '@nextui-org/react';
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
import type { AppProps } from 'next/app';
|
||||
import '../styles/globals.css';
|
||||
|
||||
function SealosDesktop({ Component, pageProps }: AppProps) {
|
||||
return <Component {...pageProps} />
|
||||
const lightTheme = createTheme({
|
||||
type: 'light',
|
||||
theme: {
|
||||
colors: {} // optional
|
||||
}
|
||||
});
|
||||
|
||||
const darkTheme = createTheme({
|
||||
type: 'dark',
|
||||
theme: {
|
||||
colors: {} // optional
|
||||
}
|
||||
});
|
||||
|
||||
function SealosCloud({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<NextThemesProvider
|
||||
defaultTheme="system"
|
||||
attribute="class"
|
||||
value={{
|
||||
light: lightTheme.className,
|
||||
dark: darkTheme.className
|
||||
}}
|
||||
>
|
||||
<NextUIProvider>
|
||||
<Component {...pageProps} />
|
||||
</NextUIProvider>
|
||||
</NextThemesProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default SealosDesktop
|
||||
export default SealosCloud;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
||||
import { CssBaseline } from '@nextui-org/react';
|
||||
|
||||
class MyDocument extends Document {
|
||||
static async getInitialProps(ctx: any) {
|
||||
const initialProps = await Document.getInitialProps(ctx);
|
||||
return {
|
||||
...initialProps,
|
||||
styles: React.Children.toArray([initialProps.styles])
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
{CssBaseline.flush()}
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MyDocument;
|
||||
@@ -1,34 +1,97 @@
|
||||
.main {
|
||||
.mainContainer {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
border: 1px solid black;
|
||||
background-color: var(--nextui-colors-accents0);
|
||||
color: var(--nextui-colors-text);
|
||||
}
|
||||
|
||||
|
||||
.menu {
|
||||
height: 40px;
|
||||
.header {
|
||||
top: 0;
|
||||
position: sticky;
|
||||
height: 24px;
|
||||
width: 100%;
|
||||
background: #f0fff0;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
border-radius: 0 0 8px 8px;
|
||||
z-index: var(--nextui-zIndices-max);
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc(100vh - 120px);
|
||||
.headerMenu {
|
||||
height: 24px;
|
||||
backdrop-filter: saturate(180%) blur(10px);
|
||||
box-shadow: var(--nextui-colors-gray500) 0px 4px 16px -4px;
|
||||
border-radius: 0 0 8px 8px;
|
||||
}
|
||||
|
||||
.headerMenuIcon {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
margin: 2px 8px;
|
||||
}
|
||||
|
||||
.headerMenuIcon:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.frameContainer {
|
||||
padding: 16px;
|
||||
/* padding: calc(24px + 8px) 8px 8px 8px; */
|
||||
height: calc(100vh - 60px - 16px);
|
||||
width: 100%;
|
||||
border: 1px solid gray;
|
||||
background: #f0f0ff;
|
||||
}
|
||||
|
||||
.container .iframe {
|
||||
.frameContainer .frameDefault {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.frameContainer .frameDefault .frameDefaultRow {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.frameContainer .iframe {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.dock {
|
||||
height: 80px;
|
||||
width: 100%;
|
||||
background: #fff0f0;
|
||||
text-align: center;
|
||||
.dockContainer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
height: 52px;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dockContent {
|
||||
display: flex;
|
||||
background: var(--nextui-colors-gray500);
|
||||
padding: 0 16px;
|
||||
border-radius: 16px;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
height: 52px;
|
||||
}
|
||||
|
||||
.dockContent .dockItem {
|
||||
display: flex;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.dockContent .dockItem .bottomAction {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.dockContent .dockItem .bottomAction:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,239 @@
|
||||
import type { NextPage } from 'next'
|
||||
import Head from 'next/head'
|
||||
import styles from './dashboard.module.css'
|
||||
import { SearchOutlined } from '@ant-design/icons';
|
||||
import { Tooltip, Button } from 'antd'
|
||||
import { Loading, Grid, Dropdown, Button, Text, User, useTheme } from '@nextui-org/react';
|
||||
import clsx from 'clsx';
|
||||
import type { NextPage } from 'next';
|
||||
import Head from 'next/head';
|
||||
import Image from 'next/future/image';
|
||||
import { useState, useEffect } from 'react';
|
||||
import Script from 'next/script';
|
||||
import styles from './dashboard.module.css';
|
||||
import { Session, getSession } from '../../store/session';
|
||||
import { useTheme as useNextTheme } from 'next-themes';
|
||||
|
||||
const Dashboard: NextPage = () => {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<title>Dashboard</title>
|
||||
<meta name="description" content="Generated by create next app" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
import IconSealOS from '../../assets/icons/sealos.svg';
|
||||
import IconSun from '../../assets/icons/sun.svg';
|
||||
import IconMoon from '../../assets/icons/moon.svg';
|
||||
import IconSearch from '../../assets/icons/search.svg';
|
||||
import IconBell from '../../assets/icons/bell.svg';
|
||||
import IconDash from '../../assets/icons/dash.svg';
|
||||
import IconPlus from '../../assets/icons/plus.svg';
|
||||
import IconX from '../../assets/icons/x.svg';
|
||||
|
||||
<main className={styles.main}>
|
||||
<div className={styles.menu}>header menu</div>
|
||||
|
||||
<div className={styles.container}>
|
||||
<iframe className={styles.iframe} src="https://kubernetes-dashboard.cloud.sealos.io/" title="kubernetes-dashboard-cloud-sealos-io" />
|
||||
</div>
|
||||
|
||||
<div className={styles.dock}>
|
||||
<Tooltip title="search">
|
||||
<Button type="primary" shape="circle" icon={<SearchOutlined />} />
|
||||
</Tooltip>
|
||||
<Tooltip title="search">
|
||||
<Button type="primary" shape="circle" icon={<SearchOutlined />} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
interface Props {
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export default Dashboard
|
||||
type iframePage = {
|
||||
title: string;
|
||||
url: string;
|
||||
icon: string;
|
||||
};
|
||||
|
||||
const Dashboard: NextPage<Props> = (props) => {
|
||||
const { setTheme } = useNextTheme();
|
||||
const { isDark, theme } = useTheme();
|
||||
|
||||
const onChangeTheme = () => setTheme(isDark ? 'light' : 'dark');
|
||||
|
||||
const [session, setSession] = useState<Session | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
const session = getSession();
|
||||
if (session !== undefined) {
|
||||
setSession(session);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const urls: iframePage[] = [
|
||||
{
|
||||
title: 'kubernetes-dashboard-cloud-sealos-io',
|
||||
url: 'https://kubernetes-dashboard.cloud.sealos.io/',
|
||||
icon: '/images/kubernetes.svg'
|
||||
},
|
||||
{
|
||||
title: 'terminal-cloud-sealos-io',
|
||||
url: 'https://terminal.cloud.sealos.io/',
|
||||
icon: '/images/terminal.svg'
|
||||
},
|
||||
{
|
||||
title: 'mysql-cloud-sealos-io',
|
||||
url: '',
|
||||
icon: '/images/mysql.svg'
|
||||
},
|
||||
{
|
||||
title: 'redis-cloud-sealos-io',
|
||||
url: '',
|
||||
icon: '/images/redis.svg'
|
||||
}
|
||||
];
|
||||
|
||||
const [currIframe, setCurrIframe] = useState<iframePage | undefined>(undefined);
|
||||
|
||||
const renderBottomDockIcon = (item: iframePage) => (
|
||||
<div key={item.url} className={styles.dockItem}>
|
||||
<div
|
||||
className={clsx(styles.bottomAction, 'bottomAction')}
|
||||
onClick={() => setCurrIframe(item)}
|
||||
>
|
||||
<Image
|
||||
alt={item.title}
|
||||
src={item.icon}
|
||||
width={36}
|
||||
height={36}
|
||||
className={clsx(styles.bottomImage, 'url-image')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Dashboard</title>
|
||||
<meta name="description" content="sealos cloud dashboard" />
|
||||
</Head>
|
||||
|
||||
<Script src="/plugins/iframeResizer.contentWindow.min.js" strategy="lazyOnload" />
|
||||
|
||||
<div className={styles.mainContainer}>
|
||||
<main className={styles.main}>
|
||||
<nav className={styles.header}>
|
||||
<div className={styles.headerMenu}>
|
||||
<Grid.Container gap={0} justify="space-between">
|
||||
<Grid md>
|
||||
<Grid.Container gap={0} justify="flex-start">
|
||||
<Grid md style={{ flex: 'none' }}>
|
||||
<div className={styles.headerMenuIcon} style={{ marginRight: 0 }}>
|
||||
<IconSealOS />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md xs={0} style={{ flex: '0 1 auto' }}>
|
||||
<Text size={12} css={{ py: 1, mr: '4px' }}>
|
||||
SealOS Cloud
|
||||
</Text>
|
||||
</Grid>
|
||||
{currIframe !== undefined && (
|
||||
<>
|
||||
<Grid md style={{ flex: '0 1 auto' }}>
|
||||
<Text size={12} css={{ py: 1, mx: '4px' }} weight="bold">
|
||||
{currIframe?.title}
|
||||
</Text>
|
||||
</Grid>
|
||||
<Grid md style={{ flex: 'none' }}>
|
||||
{session === undefined ? (
|
||||
<Button animated={false} size="xs" light color="primary" disabled>
|
||||
Information
|
||||
</Button>
|
||||
) : (
|
||||
<Dropdown disableAnimation>
|
||||
<Dropdown.Button animated={false} size="xs" light color="primary">
|
||||
Information
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Menu aria-label="Information">
|
||||
<Dropdown.Item key="token">
|
||||
{session.token.access_token}
|
||||
</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
)}
|
||||
</Grid>
|
||||
<Grid md style={{ flex: 'none' }}>
|
||||
<Dropdown disableAnimation>
|
||||
<Dropdown.Button animated={false} size="xs" light color="primary">
|
||||
Actions
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Menu aria-label="Actions">
|
||||
<Dropdown.Item key="start">Start</Dropdown.Item>
|
||||
<Dropdown.Item key="stop">Stop</Dropdown.Item>
|
||||
<Dropdown.Item key="delete" withDivider color="error">
|
||||
Delete
|
||||
</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
</Grid>
|
||||
</>
|
||||
)}
|
||||
</Grid.Container>
|
||||
</Grid>
|
||||
<Grid md style={{ flex: 'none' }}>
|
||||
<Grid.Container gap={0} justify="flex-end">
|
||||
{session && (
|
||||
<Grid md css={{ py: 1 }}>
|
||||
<User size="xs" src={session.user.avatar} name={session.user.name} />
|
||||
</Grid>
|
||||
)}
|
||||
<Grid md>
|
||||
<div className={styles.headerMenuIcon} onClick={onChangeTheme}>
|
||||
{isDark ? <IconMoon /> : <IconSun />}
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md>
|
||||
<div className={styles.headerMenuIcon}>
|
||||
<IconSearch />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md>
|
||||
<div className={styles.headerMenuIcon}>
|
||||
<IconBell />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md>
|
||||
<div
|
||||
className={styles.headerMenuIcon}
|
||||
style={{ color: theme?.colors.warning.value }}
|
||||
>
|
||||
<IconDash />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md>
|
||||
<div
|
||||
className={styles.headerMenuIcon}
|
||||
style={{ color: theme?.colors.success.value }}
|
||||
>
|
||||
<IconPlus />
|
||||
</div>
|
||||
</Grid>
|
||||
<Grid md>
|
||||
<div
|
||||
className={styles.headerMenuIcon}
|
||||
style={{ color: theme?.colors.error.value }}
|
||||
onClick={() => setCurrIframe(undefined)}
|
||||
>
|
||||
<IconX />
|
||||
</div>
|
||||
</Grid>
|
||||
</Grid.Container>
|
||||
</Grid>
|
||||
</Grid.Container>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div className={styles.frameContainer}>
|
||||
{currIframe !== undefined && currIframe.url !== '' ? (
|
||||
<iframe
|
||||
className={styles.iframe}
|
||||
src={currIframe.url}
|
||||
title={currIframe.title}
|
||||
frameBorder="0"
|
||||
marginWidth={0}
|
||||
marginHeight={0}
|
||||
/>
|
||||
) : (
|
||||
<div className={styles.frameDefault}>
|
||||
<div className={styles.frameDefaultRow}>
|
||||
<Loading type="points-opacity">Please select application below!</Loading>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className={styles.dockContainer}>
|
||||
<div className={styles.dockContent}>
|
||||
{urls.map((item) => renderBottomDockIcon(item))}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dashboard;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NextPage } from 'next'
|
||||
import Head from 'next/head'
|
||||
import Link from 'next/link'
|
||||
import styles from '../styles/Home.module.css'
|
||||
import type { NextPage } from 'next';
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
import styles from './index.module.css';
|
||||
|
||||
const Home: NextPage = () => {
|
||||
return (
|
||||
@@ -14,7 +14,7 @@ const Home: NextPage = () => {
|
||||
|
||||
<main className={styles.main}>
|
||||
<h1 className={styles.title}>
|
||||
Welcome to <Link href="https://www.sealos.io/"><a>sealos!</a></Link>
|
||||
Welcome to <Link href="https://www.sealos.io/">SealOS </Link> Cloud!
|
||||
</h1>
|
||||
|
||||
<p className={styles.description}>
|
||||
@@ -22,35 +22,24 @@ const Home: NextPage = () => {
|
||||
</p>
|
||||
|
||||
<div className={styles.grid}>
|
||||
<Link href="https://www.sealos.io/docs/intro">
|
||||
<a className={styles.card}>
|
||||
<h2>Documentation →</h2>
|
||||
<p>Find in-depth information about sealos features and API.</p>
|
||||
</a>
|
||||
<Link href="https://www.sealos.io/docs/intro" className={styles.card}>
|
||||
<h2>Documentation →</h2>
|
||||
<p>Find in-depth information about sealos features and API.</p>
|
||||
</Link>
|
||||
|
||||
<Link href="https://www.sealos.io/blog">
|
||||
<a className={styles.card}>
|
||||
<h2>Blog →</h2>
|
||||
<p>Find newest information about sealos design and news!</p>
|
||||
</a>
|
||||
<Link href="https://www.sealos.io/blog" className={styles.card}>
|
||||
<h2>Blog →</h2>
|
||||
<p>Find newest information about sealos design and news!</p>
|
||||
</Link>
|
||||
|
||||
<Link
|
||||
href="https://github.com/labring/sealos">
|
||||
<a className={styles.card}>
|
||||
<h2>GitHub →</h2>
|
||||
<p>Discover sealos in open source world!</p>
|
||||
</a>
|
||||
<Link href="https://github.com/labring/sealos" className={styles.card}>
|
||||
<h2>GitHub →</h2>
|
||||
<p>Discover sealos in open source world!</p>
|
||||
</Link>
|
||||
|
||||
<Link href="/api/login">
|
||||
<a className={styles.card}>
|
||||
<h2>Login & Register →</h2>
|
||||
<p>
|
||||
Instantly deploy your Next.js site to a public URL with Vercel.
|
||||
</p>
|
||||
</a>
|
||||
<Link href="/api/login" className={styles.card}>
|
||||
<h2>Login & Register →</h2>
|
||||
<p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
|
||||
</Link>
|
||||
</div>
|
||||
</main>
|
||||
@@ -58,13 +47,14 @@ const Home: NextPage = () => {
|
||||
<footer className={styles.footer}>
|
||||
<Link
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
passHref
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<a target="_blank" rel="noopener noreferrer">Powered by{' '} Next.js</a>
|
||||
Powered by Next.js
|
||||
</Link>
|
||||
</footer>
|
||||
</div >
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home
|
||||
export default Home;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { NextPage } from 'next'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { fetchPost } from '../../lib/api'
|
||||
import { OAuthToken, Session, setSession, UserInfo } from '../../store/session'
|
||||
import type { NextPage } from 'next';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { fetchPost } from '../../lib/api';
|
||||
import { OAuthToken, Session, setSession, UserInfo } from '../../store/session';
|
||||
|
||||
const Callback: NextPage = () => {
|
||||
const [otoken, setOToken] = useState<any>(null)
|
||||
const [uinfo, setUInfo] = useState<any>(null)
|
||||
const [redirect, setRedirect] = useState('')
|
||||
const [otoken, setOToken] = useState<any>(null);
|
||||
const [uinfo, setUInfo] = useState<any>(null);
|
||||
const [redirect, setRedirect] = useState('');
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -17,30 +17,38 @@ const Callback: NextPage = () => {
|
||||
|
||||
const { code, state } = router.query;
|
||||
if (code !== undefined && code !== '' && state !== undefined && state != '') {
|
||||
fetchPost('api/token', { code: code, state: state }).then((token) => {
|
||||
console.log(token)
|
||||
setOToken(JSON.stringify(token))
|
||||
fetchPost('api/token', { code: code, state: state })
|
||||
.then((token) => {
|
||||
console.log(token);
|
||||
setOToken(JSON.stringify(token));
|
||||
|
||||
const oauth_token = token as OAuthToken;
|
||||
if (oauth_token.access_token !== '') {
|
||||
fetchPost('api/userinfo', { code: code, state: state }, { authorization: 'Bearer ' + oauth_token.access_token }).then((userinfo) => {
|
||||
console.log(userinfo)
|
||||
setUInfo(JSON.stringify(userinfo))
|
||||
const oauth_token = token as OAuthToken;
|
||||
if (oauth_token.access_token !== '') {
|
||||
fetchPost(
|
||||
'api/userinfo',
|
||||
{ code: code, state: state },
|
||||
{ authorization: 'Bearer ' + oauth_token.access_token }
|
||||
)
|
||||
.then((userinfo) => {
|
||||
console.log(userinfo);
|
||||
setUInfo(JSON.stringify(userinfo));
|
||||
|
||||
const user_info = userinfo as UserInfo;
|
||||
if (user_info.uid !== '') {
|
||||
const session: Session = { token: oauth_token, user: user_info }
|
||||
setSession(session);
|
||||
const user_info = userinfo as UserInfo;
|
||||
if (user_info.id !== '') {
|
||||
const session: Session = { token: oauth_token, user: user_info };
|
||||
setSession(session);
|
||||
|
||||
setRedirect('/dashboard');
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
setRedirect('/dashboard');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}, [router.isReady]);
|
||||
|
||||
@@ -59,7 +67,7 @@ const Callback: NextPage = () => {
|
||||
<pre>{otoken}</pre>
|
||||
<Link href={redirect}>dashboard</Link>
|
||||
</>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default Callback
|
||||
export default Callback;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { GetServerSideProps, NextPage } from 'next'
|
||||
import { isUserLogin } from '../../store/session'
|
||||
import type { GetServerSideProps, NextPage } from 'next';
|
||||
import { isUserLogin } from '../../store/session';
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
const is_login = isUserLogin();
|
||||
let destination = '/api/login';
|
||||
if (is_login) {
|
||||
destination = '/dashboard';
|
||||
}
|
||||
return {
|
||||
redirect: { statusCode: 302, destination: destination }
|
||||
}
|
||||
}
|
||||
const is_login = isUserLogin();
|
||||
let destination = '/api/login';
|
||||
if (is_login) {
|
||||
destination = '/dashboard';
|
||||
}
|
||||
return {
|
||||
redirect: { statusCode: 302, destination: destination }
|
||||
};
|
||||
};
|
||||
|
||||
const Login: NextPage = () => <></>
|
||||
const Login: NextPage = () => <></>;
|
||||
|
||||
export default Login
|
||||
export default Login;
|
||||
|
||||
@@ -6,8 +6,9 @@ export type OAuthToken = {
|
||||
};
|
||||
|
||||
export type UserInfo = {
|
||||
readonly uid: string;
|
||||
readonly user_name: string;
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly avatar: string;
|
||||
};
|
||||
|
||||
export type Session = {
|
||||
|
||||
@@ -2,15 +2,8 @@ html,
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
|
||||
Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
||||
background-color: var(--nextui-colors-background);
|
||||
color: var(--nextui-colors-text);
|
||||
}
|
||||
|
||||