diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..423f238 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +src/client/routeTree.gen.ts diff --git a/.prettierrc.json b/.prettierrc.json index 1e15a4b..7cc1994 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -7,5 +7,6 @@ "trailingComma": "es5", "bracketSpacing": true, "arrowParens": "always", - "jsxBracketSameLine": false + "jsxBracketSameLine": false, + "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/package.json b/package.json index 37182b0..2d934e9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "concurrently": "^8.2.2", "cross-env": "^7.0.3", "fs-extra": "^11.2.0", + "prettier-plugin-tailwindcss": "^0.5.12", "release-it": "^17.0.1", "tar": "^6.1.15", "ts-node": "^10.9.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index adc62d8..e88703d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,6 +42,9 @@ importers: fs-extra: specifier: ^11.2.0 version: 11.2.0 + prettier-plugin-tailwindcss: + specifier: ^0.5.12 + version: 0.5.12(prettier@3.2.5) release-it: specifier: ^17.0.1 version: 17.0.1(typescript@5.2.2) @@ -515,7 +518,7 @@ importers: version: 3.3.5(ts-node@10.9.1) ts-node: specifier: ^10.9.1 - version: 10.9.1(@types/node@20.11.24)(typescript@4.7.4) + version: 10.9.1(@types/node@18.17.12)(typescript@4.7.4) typescript: specifier: ^4.7.4 version: 4.7.4 @@ -6133,7 +6136,7 @@ packages: peerDependencies: react: '*' dependencies: - '@types/react': 18.2.21 + '@types/react': 18.2.61 prop-types: 15.8.1 react: 17.0.2 @@ -9781,12 +9784,6 @@ packages: /@types/node@18.17.12: resolution: {integrity: sha512-d6xjC9fJ/nSnfDeU0AMDsaJyb1iHsqCSOdi84w4u+SlN/UgQdY5tRhpMzaFYsI4mnpvgTivEaQd0yOUhAtOnEQ==} - /@types/node@20.11.24: - resolution: {integrity: sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==} - dependencies: - undici-types: 5.26.5 - dev: true - /@types/nodemailer@6.4.11: resolution: {integrity: sha512-Ld2c0frwpGT4VseuoeboCXQ7UJIkK3X7Lx/4YsZEiUHtHsthWAOCYtf6PAiLhMtfwV0cWJRabLBS3+LD8x6Nrw==} dependencies: @@ -9891,7 +9888,7 @@ packages: resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==} dependencies: '@types/history': 4.7.11 - '@types/react': 18.2.21 + '@types/react': 18.2.61 /@types/react-slick@0.23.11: resolution: {integrity: sha512-52AbNhYN7u0ATqAUvap2MXNG3znUsJslAWgebUHrovvnJ6EG6oic+TZyC82XiwwvijRMyL2V0C2wPJbzsSwllw==} @@ -20048,12 +20045,73 @@ packages: engines: {node: '>=4'} dev: false + /prettier-plugin-tailwindcss@0.5.12(prettier@3.2.5): + resolution: {integrity: sha512-o74kiDBVE73oHW+pdkFSluHBL3cYEvru5YgEqNkBMFF7Cjv+w1vI565lTlfoJT4VLWDe0FMtZ7FkE/7a4pMXSQ==} + engines: {node: '>=14.21.3'} + peerDependencies: + '@ianvs/prettier-plugin-sort-imports': '*' + '@prettier/plugin-pug': '*' + '@shopify/prettier-plugin-liquid': '*' + '@trivago/prettier-plugin-sort-imports': '*' + prettier: ^3.0 + prettier-plugin-astro: '*' + prettier-plugin-css-order: '*' + prettier-plugin-import-sort: '*' + prettier-plugin-jsdoc: '*' + prettier-plugin-marko: '*' + prettier-plugin-organize-attributes: '*' + prettier-plugin-organize-imports: '*' + prettier-plugin-sort-imports: '*' + prettier-plugin-style-order: '*' + prettier-plugin-svelte: '*' + prettier-plugin-twig-melody: '*' + peerDependenciesMeta: + '@ianvs/prettier-plugin-sort-imports': + optional: true + '@prettier/plugin-pug': + optional: true + '@shopify/prettier-plugin-liquid': + optional: true + '@trivago/prettier-plugin-sort-imports': + optional: true + prettier-plugin-astro: + optional: true + prettier-plugin-css-order: + optional: true + prettier-plugin-import-sort: + optional: true + prettier-plugin-jsdoc: + optional: true + prettier-plugin-marko: + optional: true + prettier-plugin-organize-attributes: + optional: true + prettier-plugin-organize-imports: + optional: true + prettier-plugin-sort-imports: + optional: true + prettier-plugin-style-order: + optional: true + prettier-plugin-svelte: + optional: true + prettier-plugin-twig-melody: + optional: true + dependencies: + prettier: 3.2.5 + dev: true + /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} hasBin: true dev: true + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-error@4.0.0: resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==} dependencies: @@ -24317,6 +24375,37 @@ packages: code-block-writer: 12.0.0 dev: true + /ts-node@10.9.1(@types/node@18.17.12)(typescript@4.7.4): + resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 18.17.12 + acorn: 8.11.3 + acorn-walk: 8.3.2 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 4.7.4 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: true + /ts-node@10.9.1(@types/node@18.17.12)(typescript@5.2.2): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -24379,37 +24468,6 @@ packages: yn: 3.1.1 dev: false - /ts-node@10.9.1(@types/node@20.11.24)(typescript@4.7.4): - resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.11.24 - acorn: 8.11.3 - acorn-walk: 8.3.2 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 4.7.4 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: true - /ts-pattern@4.3.0: resolution: {integrity: sha512-pefrkcd4lmIVR0LA49Imjf9DYLK8vtWhqBPA3Ya1ir8xCW0O2yjL9dsCVvI7pCodLC5q7smNpEtDR2yVulQxOg==} dev: true @@ -24624,10 +24682,6 @@ packages: resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} dev: true - /undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - dev: true - /unenv@1.7.4: resolution: {integrity: sha512-fjYsXYi30It0YCQYqLOcT6fHfMXsBr2hw9XC7ycf8rTG7Xxpe3ZssiqUnD0khrjiZEmkBXWLwm42yCSCH46fMw==} dependencies: diff --git a/src/client/api/socketio.ts b/src/client/api/socketio.ts index 5dab5ab..e89391b 100644 --- a/src/client/api/socketio.ts +++ b/src/client/api/socketio.ts @@ -117,7 +117,7 @@ interface UseSocketSubscribeListOptions { const defaultFilter = () => true; export function useSocketSubscribeList< K extends keyof SubscribeEventMap = keyof SubscribeEventMap, - T = SubscribeEventData + T = SubscribeEventData, >(name: K, options: UseSocketSubscribeListOptions = {}): T[] { const { filter = defaultFilter } = options; const { subscribe } = useSocket(); diff --git a/src/client/components/DateFilter.tsx b/src/client/components/DateFilter.tsx index 927f53e..a8916e4 100644 --- a/src/client/components/DateFilter.tsx +++ b/src/client/components/DateFilter.tsx @@ -115,7 +115,7 @@ export const DateFilter: React.FC = React.memo((props) => { {label} diff --git a/src/client/components/EditableText.tsx b/src/client/components/EditableText.tsx index f44c696..7fe3b9d 100644 --- a/src/client/components/EditableText.tsx +++ b/src/client/components/EditableText.tsx @@ -23,7 +23,7 @@ export const EditableText: React.FC = React.memo((props) => { setText(e.target.value)} diff --git a/src/client/components/HealthBar.tsx b/src/client/components/HealthBar.tsx index 48a2422..c2eea23 100644 --- a/src/client/components/HealthBar.tsx +++ b/src/client/components/HealthBar.tsx @@ -27,10 +27,10 @@ export const HealthBar: React.FC = React.memo((props) => { key={i} title={beat.title} className={clsx( - 'rounded-full hover:scale-150 transition-transform', + 'rounded-full transition-transform hover:scale-150', { - 'w-[5px] h-4': size === 'small', - 'w-2 h-8': size === 'large', + 'h-4 w-[5px]': size === 'small', + 'h-8 w-2': size === 'large', }, { 'bg-green-500': beat.status === 'health', diff --git a/src/client/components/LanguageSelector.tsx b/src/client/components/LanguageSelector.tsx index 1cedb04..b05f4b3 100644 --- a/src/client/components/LanguageSelector.tsx +++ b/src/client/components/LanguageSelector.tsx @@ -65,7 +65,7 @@ LanguageSelector.displayName = 'LanguageSelector'; export const CountryFlag: React.FC<{ code: string }> = React.memo((props) => { return ( ); diff --git a/src/client/components/MetricCard.tsx b/src/client/components/MetricCard.tsx index 10acf4b..90e0991 100644 --- a/src/client/components/MetricCard.tsx +++ b/src/client/components/MetricCard.tsx @@ -29,8 +29,8 @@ export const MetricCard: React.FC = React.memo((props) => { ); return ( -
-
+
+
{format(value)}
@@ -44,8 +44,8 @@ export const MetricCard: React.FC = React.memo((props) => {
{showPreviousPeriod && ( -
-
+
+
{format(prev)}
diff --git a/src/client/components/NavItem.tsx b/src/client/components/NavItem.tsx index 1102a89..877e091 100644 --- a/src/client/components/NavItem.tsx +++ b/src/client/components/NavItem.tsx @@ -13,9 +13,9 @@ export const NavItem: React.FC<{ return (
diff --git a/src/client/components/PageHeader.tsx b/src/client/components/PageHeader.tsx index 253eb3b..0bb0f76 100644 --- a/src/client/components/PageHeader.tsx +++ b/src/client/components/PageHeader.tsx @@ -8,12 +8,12 @@ export const PageHeader: React.FC<{ action?: React.ReactNode; }> = React.memo((props) => { return ( -
-
+
+
{props.title} {props.desc && ( - + )}
diff --git a/src/client/components/TimeEventChart.tsx b/src/client/components/TimeEventChart.tsx index 4f41b66..ba76e78 100644 --- a/src/client/components/TimeEventChart.tsx +++ b/src/client/components/TimeEventChart.tsx @@ -37,7 +37,7 @@ export const TimeEventChart: React.FC<{ formatter: (text) => formatDateWithUnit(text, props.unit), }, }, - } satisfies ColumnConfig), + }) satisfies ColumnConfig, [props.data, props.unit] ); diff --git a/src/client/components/dashboard/AddButton.tsx b/src/client/components/dashboard/AddButton.tsx index 749c46f..9296f7d 100644 --- a/src/client/components/dashboard/AddButton.tsx +++ b/src/client/components/dashboard/AddButton.tsx @@ -154,7 +154,7 @@ export const DashboardItemAddButton: React.FC = React.memo(() => { {t('Add')} diff --git a/src/client/components/dashboard/Dashboard.tsx b/src/client/components/dashboard/Dashboard.tsx index cc0b69e..b1faac7 100644 --- a/src/client/components/dashboard/Dashboard.tsx +++ b/src/client/components/dashboard/Dashboard.tsx @@ -51,7 +51,7 @@ export const Dashboard: React.FC = React.memo(() => {
diff --git a/src/client/components/modals/NotificationInfo/index.tsx b/src/client/components/modals/NotificationInfo/index.tsx index 5c7573f..e18785b 100644 --- a/src/client/components/modals/NotificationInfo/index.tsx +++ b/src/client/components/modals/NotificationInfo/index.tsx @@ -104,7 +104,7 @@ export const NotificationInfoModal: React.FC =
} > -
+
= React.memo( navigate(`/monitor/${item.monitorId}`); }} > -
+
{item.type} diff --git a/src/client/components/monitor/MonitorHealthBar.tsx b/src/client/components/monitor/MonitorHealthBar.tsx index 2bced75..bc489ec 100644 --- a/src/client/components/monitor/MonitorHealthBar.tsx +++ b/src/client/components/monitor/MonitorHealthBar.tsx @@ -87,21 +87,21 @@ export const MonitorHealthBar: React.FC = React.memo( }); return ( -
+
{showCurrentStatus && ( <> {last(beats)?.status === 'health' ? ( -
+
{t('UP')}
) : last(beats)?.status === 'error' ? ( -
+
{t('DOWN')}
) : ( -
+
{t('NONE')}
)} diff --git a/src/client/components/monitor/MonitorInfo.tsx b/src/client/components/monitor/MonitorInfo.tsx index db0d480..5125e1e 100644 --- a/src/client/components/monitor/MonitorInfo.tsx +++ b/src/client/components/monitor/MonitorInfo.tsx @@ -165,15 +165,15 @@ export const MonitorInfo: React.FC = React.memo((props) => { } return ( -
+
-
+
{monitorInfo.name} {monitorInfo.active === false && ( -
+
{t('Stopped')}
)} @@ -187,7 +187,7 @@ export const MonitorInfo: React.FC = React.memo((props) => {
-
+
{t('Monitored for {{dayNum}} days', { dayNum: dayjs().diff(dayjs(monitorInfo.createdAt), 'days'), })} diff --git a/src/client/components/monitor/MonitorListItem.tsx b/src/client/components/monitor/MonitorListItem.tsx index 8229826..bcdb12d 100644 --- a/src/client/components/monitor/MonitorListItem.tsx +++ b/src/client/components/monitor/MonitorListItem.tsx @@ -70,7 +70,7 @@ export const MonitorListItem: React.FC<{
diff --git a/src/client/components/monitor/MonitorStatsBlock.tsx b/src/client/components/monitor/MonitorStatsBlock.tsx index fdcb483..d5e662f 100644 --- a/src/client/components/monitor/MonitorStatsBlock.tsx +++ b/src/client/components/monitor/MonitorStatsBlock.tsx @@ -9,7 +9,7 @@ export const MonitorStatsBlock: React.FC = React.memo( (props) => { return (
-
{props.title}
+
{props.title}
{props.desc}
{props.text}
diff --git a/src/client/components/monitor/StatusPage/EditForm.tsx b/src/client/components/monitor/StatusPage/EditForm.tsx index 64f4b4b..8f774a8 100644 --- a/src/client/components/monitor/StatusPage/EditForm.tsx +++ b/src/client/components/monitor/StatusPage/EditForm.tsx @@ -75,7 +75,7 @@ export const MonitorStatusPageEditForm: React.FC return ( <> -
+
{fields.map((field, index) => ( // monitor item <> @@ -95,7 +95,7 @@ export const MonitorStatusPageEditForm: React.FC -
+
- + {t('Show Current Response')}
remove(field.name)} />
diff --git a/src/client/components/monitor/StatusPage/Services.tsx b/src/client/components/monitor/StatusPage/Services.tsx index 0be5e21..8819762 100644 --- a/src/client/components/monitor/StatusPage/Services.tsx +++ b/src/client/components/monitor/StatusPage/Services.tsx @@ -29,7 +29,7 @@ export const StatusPageServices: React.FC = React.memo( } return ( -
+
{list.length > 0 ? ( list.map((item) => ( = React.memo( ); return ( -
+
{editMode && ( -
+
= React.memo( )}
-
{info?.title}
+
{info?.title}
@@ -99,7 +99,7 @@ export const MonitorStatusPage: React.FC = React.memo(
)} -
{t('Services')}
+
{t('Services')}
{info && ( { return ( -
+
-
+
diff --git a/src/client/pages/Register.tsx b/src/client/pages/Register.tsx index cab5edc..331467e 100644 --- a/src/client/pages/Register.tsx +++ b/src/client/pages/Register.tsx @@ -25,10 +25,10 @@ export const Register: React.FC = React.memo(() => { }); return ( -
+
- +
{t('Register Account')} diff --git a/src/client/pages/Servers.tsx b/src/client/pages/Servers.tsx index 22db32f..eb653cc 100644 --- a/src/client/pages/Servers.tsx +++ b/src/client/pages/Servers.tsx @@ -56,8 +56,8 @@ export const Servers: React.FC = React.memo(() => { return (
-
-
{t('Servers')}
+
+
{t('Servers')}
{ format: 'text/plain', text: command, }} - className="h-[96px] flex p-2 rounded bg-black bg-opacity-5 border border-black border-opacity-10 overflow-auto" + className="flex h-[96px] overflow-auto rounded border border-black border-opacity-10 bg-black bg-opacity-5 p-2" > {command} diff --git a/src/client/pages/Settings/AuditLog.tsx b/src/client/pages/Settings/AuditLog.tsx index 7d3edd4..e39ee2b 100644 --- a/src/client/pages/Settings/AuditLog.tsx +++ b/src/client/pages/Settings/AuditLog.tsx @@ -59,7 +59,7 @@ export const AuditLog: React.FC = React.memo(() => { -
+
{virtualItems.length === 0 && }
{ t('Nothing more to load') ) ) : ( -
+
{item.relatedType && ( )}
{dayjs(item.createdAt).format('MM-DD HH:mm')}
-
+
{item.content}
diff --git a/src/client/pages/Settings/Usage.tsx b/src/client/pages/Settings/Usage.tsx index 2d9398d..572e36b 100644 --- a/src/client/pages/Settings/Usage.tsx +++ b/src/client/pages/Settings/Usage.tsx @@ -26,9 +26,9 @@ export const Usage: React.FC = React.memo(() => { -
+
{t('Statistic Date')}: - + {startDate.format('YYYY/MM/DD')} - {endDate.format('YYYY/MM/DD')}
diff --git a/src/client/pages/Settings/index.tsx b/src/client/pages/Settings/index.tsx index 3846d5b..eea97ce 100644 --- a/src/client/pages/Settings/index.tsx +++ b/src/client/pages/Settings/index.tsx @@ -54,7 +54,7 @@ export const SettingsPage: React.FC = React.memo(() => { return (
-
+
{ items={items} />
-
+
} /> } /> diff --git a/src/client/pages/Telemetry/Detail.tsx b/src/client/pages/Telemetry/Detail.tsx index 48d617a..f11a6d4 100644 --- a/src/client/pages/Telemetry/Detail.tsx +++ b/src/client/pages/Telemetry/Detail.tsx @@ -32,7 +32,7 @@ export const TelemetryDetailPage: React.FC = React.memo(() => { /> - + { /> - + { /> - + { - + { endAt={endAt} /> - + { endAt={endAt} /> - + { endAt={endAt} /> - + { endAt={endAt} /> - + { endAt={endAt} /> - + { /> - + { return (
-
+