From c8713a79d6ab47218f580fe5c80c1b72394138c8 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 15:02:57 -0600 Subject: [PATCH 1/8] add eslint-plugin-simple-import-sort dependency and configuration --- .eslintrc.yaml | 30 ++++++++++++++++++++++++++++++ package-lock.json | 10 ++++++++++ package.json | 1 + 3 files changed, 41 insertions(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 776a8f0da5..bcb15c9147 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -13,6 +13,7 @@ plugins: - 'eslint-plugin-react-native' - 'eslint-plugin-react-hooks' - '@tanstack/eslint-plugin-query' + - 'simple-import-sort' extends: - 'eslint:recommended' @@ -125,3 +126,32 @@ rules: # eslint-plugin-jsx-expressions – https://github.com/hpersson/eslint-plugin-jsx-expressions/ jsx-expressions/strict-logical-expressions: warn + + # eslint-plugin-simple-import-sort https://github.com/lydell/eslint-plugin-simple-import-sort/ + simple-import-sort/exports: error + simple-import-sort/imports: [ + error, + groups: [ + # Node.js builtins. You could also generate this regex if you use a `.js` config. + # For example: `^(${require('module').builtinModules.join('|')})(/|$)` + # Note that if you use the `node:` prefix for Node.js builtins, + # you can avoid this complexity: You can simply use '^node:'. + [ + '^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)', + ], + # Packages. `react` related packages come first. + ['^react', '^@?\\w'], + # Group the many `react-native-*` imports next. + ['^react-native-', '^@react-navigation'], + # Internal packages. + ['^(@|@frogpond|@hawkrives|components|modules|util|config)(/.*|$)'], + # Side effect imports. + ['^\\u0000'], + # Parent imports. Put `..` last. + ['^\\.\\.(?!/?$)', '^\\.\\./?$'], + # Other relative imports. Put same-folder imports and `.` last. + ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], + # Style imports. + ['^.+\\.s?css$'], + ], + ] diff --git a/package-lock.json b/package-lock.json index b946ec4550..3f81311b96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,6 +103,7 @@ "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-native": "4.0.0", + "eslint-plugin-simple-import-sort": "10.0.0", "jest": "29.6.4", "js-yaml": "4.1.0", "junk": "4.0.1", @@ -9379,6 +9380,15 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-rule-composer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", diff --git a/package.json b/package.json index 3fc1e26ca1..da8df91ca4 100644 --- a/package.json +++ b/package.json @@ -139,6 +139,7 @@ "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-native": "4.0.0", + "eslint-plugin-simple-import-sort": "10.0.0", "jest": "29.6.4", "js-yaml": "4.1.0", "junk": "4.0.1", From b77eb65032210eb0af47c0165c28f7f91ebe19f5 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 15:06:21 -0600 Subject: [PATCH 2/8] add estlin-plugin-import dependency and configuration --- .eslintrc.yaml | 6 ++ package-lock.json | 186 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 193 insertions(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index bcb15c9147..63b7458fb1 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -14,6 +14,7 @@ plugins: - 'eslint-plugin-react-hooks' - '@tanstack/eslint-plugin-query' - 'simple-import-sort' + - 'import' extends: - 'eslint:recommended' @@ -127,6 +128,11 @@ rules: # eslint-plugin-jsx-expressions – https://github.com/hpersson/eslint-plugin-jsx-expressions/ jsx-expressions/strict-logical-expressions: warn + # eslint-plugin-import https://github.com/import-js/eslint-plugin-import/ + import/first: error + import/newline-after-import: error + import/no-duplicates: error + # eslint-plugin-simple-import-sort https://github.com/lydell/eslint-plugin-simple-import-sort/ simple-import-sort/exports: error simple-import-sort/imports: [ diff --git a/package-lock.json b/package-lock.json index 3f81311b96..55957ab988 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,6 +99,7 @@ "eslint": "8.48.0", "eslint-config-prettier": "8.10.0", "eslint-plugin-babel": "5.3.1", + "eslint-plugin-import": "2.28.1", "eslint-plugin-jsx-expressions": "1.3.1", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", @@ -6182,6 +6183,12 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/@types/lodash": { "version": "4.14.195", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", @@ -6925,6 +6932,25 @@ "node": ">=0.10.0" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.flat": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", @@ -9270,6 +9296,69 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, "node_modules/eslint-plugin-babel": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/eslint-plugin-babel/-/eslint-plugin-babel-5.3.1.tgz", @@ -9285,6 +9374,58 @@ "eslint": ">=4.0.0" } }, + "node_modules/eslint-plugin-import": { + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.findlastindex": "^1.2.2", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.8.0", + "has": "^1.0.3", + "is-core-module": "^2.13.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.6", + "object.groupby": "^1.0.0", + "object.values": "^1.1.6", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint-plugin-jsx-expressions": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-expressions/-/eslint-plugin-jsx-expressions-1.3.1.tgz", @@ -15966,6 +16107,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "node_modules/object.hasown": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", @@ -19149,6 +19302,39 @@ } } }, + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", diff --git a/package.json b/package.json index da8df91ca4..c958ad2818 100644 --- a/package.json +++ b/package.json @@ -135,6 +135,7 @@ "eslint": "8.48.0", "eslint-config-prettier": "8.10.0", "eslint-plugin-babel": "5.3.1", + "eslint-plugin-import": "2.28.1", "eslint-plugin-jsx-expressions": "1.3.1", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", From 9c7241c7f8384f15d62a8e4079c7a42a5cec0e2d Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 15:18:25 -0600 Subject: [PATCH 3/8] remove newline after import rule --- .eslintrc.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 63b7458fb1..cb118fe61f 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -130,7 +130,6 @@ rules: # eslint-plugin-import https://github.com/import-js/eslint-plugin-import/ import/first: error - import/newline-after-import: error import/no-duplicates: error # eslint-plugin-simple-import-sort https://github.com/lydell/eslint-plugin-simple-import-sort/ From b391adaf07721604d4a414e012cc6e1d21f2e402 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 15:26:03 -0600 Subject: [PATCH 4/8] group react native and react navigation packages separately --- .eslintrc.yaml | 51 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index cb118fe61f..194f5da6af 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -134,29 +134,28 @@ rules: # eslint-plugin-simple-import-sort https://github.com/lydell/eslint-plugin-simple-import-sort/ simple-import-sort/exports: error - simple-import-sort/imports: [ - error, - groups: [ - # Node.js builtins. You could also generate this regex if you use a `.js` config. - # For example: `^(${require('module').builtinModules.join('|')})(/|$)` - # Note that if you use the `node:` prefix for Node.js builtins, - # you can avoid this complexity: You can simply use '^node:'. - [ - '^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)', - ], - # Packages. `react` related packages come first. - ['^react', '^@?\\w'], - # Group the many `react-native-*` imports next. - ['^react-native-', '^@react-navigation'], - # Internal packages. - ['^(@|@frogpond|@hawkrives|components|modules|util|config)(/.*|$)'], - # Side effect imports. - ['^\\u0000'], - # Parent imports. Put `..` last. - ['^\\.\\.(?!/?$)', '^\\.\\./?$'], - # Other relative imports. Put same-folder imports and `.` last. - ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], - # Style imports. - ['^.+\\.s?css$'], - ], - ] + simple-import-sort/imports: [error, groups: [ + # Node.js builtins. You could also generate this regex if you use a `.js` config. + # For example: `^(${require('module').builtinModules.join('|')})(/|$)` + # Note that if you use the `node:` prefix for Node.js builtins, + # you can avoid this complexity: You can simply use '^node:'. + [ + '^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)', + ], + # Packages. `react` related packages come first. + ['^react', '^@?\\w'], + # react-native community packages + ['^react-native-'], + # React navigation + ['^@react-navigation'], + # Internal packages. + ['^(@|@frogpond|@hawkrives|components|modules|util|config)(/.*|$)'], + # Side effect imports. + ['^\\u0000'], + # Parent imports. Put `..` last. + ['^\\.\\.(?!/?$)', '^\\.\\./?$'], + # Other relative imports. Put same-folder imports and `.` last. + ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], + # Style imports. + ['^.+\\.s?css$'], + ]] From fc2d663b9253f81043ca0d4d58a748deb6803ec9 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 15:27:09 -0600 Subject: [PATCH 5/8] lint with rules from simple-import-sort and import --- images/news-sources/index.ts | 1 - images/spaces/index.ts | 2 +- images/webcams/index.ts | 2 +- .../add-to-device-calendar/add-to-calendar.ts | 2 + modules/add-to-device-calendar/lib.ts | 9 +++-- modules/app-theme/index.ts | 2 +- modules/app-theme/paper.ts | 10 ++--- modules/badge/outline.tsx | 1 + modules/badge/solid.tsx | 1 + modules/button/index.tsx | 5 ++- modules/ccc-calendar/index.tsx | 8 ++-- modules/ccc-calendar/query.ts | 5 ++- modules/colors/index.ts | 3 +- modules/colors/platform.ts | 2 +- modules/colors/util.ts | 2 +- modules/context-menu/index.tsx | 5 ++- modules/datepicker/basepicker.tsx | 8 ++-- modules/datepicker/datepicker-android.tsx | 1 + modules/datepicker/datepicker-ios.tsx | 1 + modules/datepicker/datepicker.ts | 2 +- modules/datepicker/types.ts | 3 +- modules/event-list/__tests__/times.test.ts | 6 +-- modules/event-list/calendar-util.ts | 1 + modules/event-list/event-detail-android.tsx | 17 +++++---- modules/event-list/event-detail-ios.tsx | 15 +++++--- modules/event-list/event-detail.tsx | 11 +++--- modules/event-list/event-list.tsx | 13 ++++--- modules/event-list/event-row.tsx | 6 ++- modules/event-list/index.ts | 5 +-- modules/event-list/times.ts | 5 ++- modules/event-list/types.ts | 1 + modules/event-list/vertical-bar.tsx | 1 + .../__tests__/apply-and-list-filter.test.ts | 2 +- modules/filter/__tests__/apply-filter.test.ts | 4 +- .../__tests__/apply-or-list-filter.test.ts | 2 +- .../__tests__/apply-toggle-filter.test.ts | 2 +- modules/filter/active-filter-button.tsx | 5 ++- modules/filter/apply-filters.ts | 4 +- modules/filter/filter-popover.tsx | 9 +++-- modules/filter/filter-toolbar-button.tsx | 7 +++- modules/filter/filter-toolbar.tsx | 8 ++-- modules/filter/index.ts | 8 ++-- modules/filter/section-list.tsx | 11 +++--- modules/filter/section-picker.tsx | 4 +- modules/filter/section-toggle.tsx | 4 +- modules/filter/section.tsx | 5 ++- modules/food-menu/dietary-tags-detail.tsx | 4 +- modules/food-menu/fancy-menu.tsx | 21 +++++----- modules/food-menu/filter-menu-toolbar.tsx | 6 ++- modules/food-menu/food-item-detail.tsx | 13 ++++--- modules/food-menu/food-item-row.tsx | 9 +++-- modules/food-menu/index.ts | 11 +++--- modules/food-menu/lib/build-filters.ts | 13 ++++--- modules/food-menu/lib/choose-meal.ts | 5 ++- modules/food-menu/lib/find-menu.ts | 7 ++-- modules/html-content/index.tsx | 4 +- modules/html-lib/index.ts | 10 ++--- modules/icon/index.ts | 5 +-- modules/icon/platform-prefix-icon-name.ts | 3 +- modules/icon/source.ts | 2 +- modules/info-header/index.tsx | 1 + modules/layout/index.ts | 2 +- modules/lists/disclosure-arrow.tsx | 4 +- modules/lists/index.ts | 12 +++--- modules/lists/list-empty.tsx | 1 + modules/lists/list-footer.tsx | 1 + modules/lists/list-item-detail.tsx | 5 ++- modules/lists/list-item-title.tsx | 1 + modules/lists/list-row.tsx | 4 +- modules/lists/list-section-header.tsx | 1 + modules/lists/list-separator.tsx | 1 + modules/markdown/code.tsx | 2 +- modules/markdown/formatting.tsx | 7 +++- modules/markdown/heading.tsx | 5 ++- modules/markdown/index.ts | 4 +- modules/markdown/link.tsx | 8 ++-- modules/markdown/list.tsx | 6 ++- modules/markdown/markdown.tsx | 20 +++++----- modules/navigation-buttons/close-screen.tsx | 9 +++-- modules/navigation-buttons/debug.tsx | 5 ++- modules/navigation-buttons/favorite.tsx | 3 ++ modules/navigation-buttons/index.ts | 6 +-- modules/navigation-buttons/open-settings.tsx | 11 ++++-- modules/navigation-buttons/search.tsx | 5 ++- modules/navigation-buttons/share.tsx | 2 + modules/navigation-buttons/styles.ts | 2 +- modules/navigation-tabs/tabbar-icon.tsx | 5 ++- modules/navigation-tabs/tabbed-view.tsx | 3 +- modules/notice/loading.tsx | 1 + modules/notice/notice.tsx | 3 +- modules/open-url/__tests__/open-url.test.ts | 3 +- modules/open-url/index.ts | 2 +- modules/open-url/open-url.ts | 2 + modules/separator/index.tsx | 5 ++- modules/silly-card/index.tsx | 10 +++-- modules/storage/__tests__/storage.test.ts | 3 +- modules/tableview/cells/button.tsx | 3 +- modules/tableview/cells/delete-button.tsx | 6 ++- modules/tableview/cells/index.ts | 4 +- modules/tableview/cells/multi-line-detail.tsx | 3 +- .../cells/multi-line-left-detail.tsx | 3 +- modules/tableview/cells/push-button.tsx | 3 +- modules/tableview/cells/selectable.tsx | 3 +- modules/tableview/cells/textfield.tsx | 3 +- modules/tableview/cells/toggle.tsx | 3 +- modules/tableview/index.tsx | 8 ++-- modules/timer/index.ts | 3 +- modules/toolbar/toolbar-button.tsx | 7 ++-- modules/toolbar/toolbar.tsx | 1 + modules/touchable/index.tsx | 1 + modules/use-debounce/index.ts | 2 +- source/app.tsx | 33 ++++++++-------- source/components/__tests__/email.test.ts | 2 +- .../components/__tests__/phonenumber.test.ts | 2 +- source/components/call-phone.ts | 4 +- source/components/send-email.ts | 4 +- source/init/api.ts | 3 +- source/init/constants.ts | 6 +-- source/init/network.ts | 3 +- source/init/sentry.ts | 3 +- source/init/tanstack-query.ts | 5 ++- source/lib/course-search/index.ts | 2 +- source/lib/course-search/urls.ts | 2 +- source/lib/financials/balances.ts | 6 +-- source/lib/login.ts | 15 ++++---- source/lib/refresh.ts | 8 ++-- source/lib/stoprint/__mocks__/api.ts | 12 +++--- source/lib/stoprint/api.ts | 15 ++++---- source/lib/stoprint/index.ts | 20 +++++----- source/lib/storage.ts | 1 + source/lib/theme.ts | 8 ++-- source/navigation/index.ts | 2 +- source/navigation/routes.tsx | 33 ++++++++-------- source/navigation/types.tsx | 31 ++++++++------- source/redux/hooks.ts | 5 ++- source/redux/index.ts | 4 +- source/redux/parts/buildings.ts | 4 +- source/redux/parts/courses.ts | 10 ++--- source/redux/parts/settings.ts | 4 +- source/redux/store.ts | 14 +++---- source/root.ts | 7 ++-- .../views/building-hours/detail/building.tsx | 15 ++++---- source/views/building-hours/detail/header.tsx | 6 ++- source/views/building-hours/detail/index.tsx | 11 ++++-- .../detail/link-table-android.tsx | 4 +- .../building-hours/detail/link-table-ios.tsx | 6 ++- .../views/building-hours/detail/link-table.ts | 2 +- .../detail/schedule-row-android.tsx | 6 +-- .../detail/schedule-row-ios.tsx | 6 ++- .../building-hours/detail/schedule-row.ts | 2 +- .../detail/schedule-table-android.tsx | 10 +++-- .../detail/schedule-table-ios.tsx | 8 ++-- .../building-hours/detail/schedule-table.ts | 2 +- .../building-hours/detail/toolbar-button.tsx | 4 +- source/views/building-hours/index.ts | 6 +-- .../__tests__/format-building-times.test.ts | 4 +- .../get-detailed-building-status.test.ts | 4 +- .../lib/__tests__/get-schedule-status.test.ts | 4 +- .../get-short-building-status.test.ts | 4 +- .../lib/__tests__/is-building-open.test.ts | 4 +- .../lib/__tests__/is-chapel-time.test.ts | 2 +- .../is-schedule-open-at-moment.test.ts | 4 +- .../lib/__tests__/parse-hours.test.ts | 4 +- .../lib/__tests__/summarize-days.test.ts | 4 +- source/views/building-hours/lib/chapel.ts | 5 +-- .../views/building-hours/lib/color-helpers.ts | 3 +- .../views/building-hours/lib/format-times.ts | 3 +- .../building-hours/lib/get-day-of-week.ts | 2 +- .../building-hours/lib/get-detailed-status.ts | 9 ++--- .../building-hours/lib/get-schedule-status.ts | 3 +- .../building-hours/lib/get-short-status.ts | 3 +- source/views/building-hours/lib/index.ts | 18 ++++----- .../building-hours/lib/is-building-open.ts | 7 ++-- .../building-hours/lib/is-schedule-open.ts | 3 +- .../lib/is-schedule-really-open.ts | 3 +- .../views/building-hours/lib/parse-hours.ts | 6 +-- .../building-hours/lib/summarize-days.ts | 7 ++-- source/views/building-hours/list.tsx | 16 ++++---- source/views/building-hours/query.ts | 5 ++- source/views/building-hours/report/editor.tsx | 25 ++++++------ source/views/building-hours/report/index.ts | 2 +- .../views/building-hours/report/overview.tsx | 27 +++++++------ source/views/building-hours/report/submit.ts | 4 +- source/views/building-hours/row.tsx | 12 +++--- source/views/calendar/index.tsx | 9 +++-- source/views/contacts/detail.tsx | 23 ++++++----- source/views/contacts/index.ts | 2 +- source/views/contacts/list.tsx | 11 ++++-- source/views/contacts/query.ts | 3 +- source/views/contacts/row.tsx | 6 ++- source/views/dictionary/detail.tsx | 12 +++--- source/views/dictionary/index.ts | 2 +- source/views/dictionary/list.tsx | 14 +++---- source/views/dictionary/query.ts | 3 +- .../report/__tests__/stringify-entry.test.ts | 2 +- source/views/dictionary/report/editor.tsx | 13 ++++--- source/views/dictionary/report/submit.ts | 4 +- source/views/directory/detail.android.tsx | 24 +++++++----- source/views/directory/detail.ios.tsx | 23 ++++++----- source/views/directory/detail.ts | 10 ++--- source/views/directory/helpers.ts | 20 +++++----- source/views/directory/index.ts | 2 +- source/views/directory/list.tsx | 20 ++++++---- source/views/directory/query.ts | 4 +- source/views/faqs/index.tsx | 7 +++- source/views/faqs/query.ts | 1 + source/views/home/button.tsx | 9 +++-- source/views/home/index.tsx | 16 ++++---- source/views/home/notice.tsx | 8 ++-- source/views/menus/carleton-menus.tsx | 9 +++-- source/views/menus/dev-bonapp-picker.tsx | 9 +++-- source/views/menus/index.tsx | 10 +++-- .../menus/lib/__tests__/find-menu.test.ts | 4 +- .../menus/lib/__tests__/menu-item.mock.ts | 2 +- .../menus/lib/__tests__/trim-names.test.ts | 2 +- source/views/menus/menu-bonapp.tsx | 16 ++++---- source/views/menus/menu-github.tsx | 8 ++-- source/views/menus/query.ts | 5 ++- source/views/menus/types.ts | 22 +++++------ source/views/more/index.tsx | 21 +++++----- source/views/more/query.ts | 3 +- source/views/news/index.tsx | 6 ++- .../news/lib/__tests__/clean-entries.test.ts | 2 +- .../lib/__tests__/trim-categories.test.ts | 2 +- source/views/news/lib/util.ts | 1 + source/views/news/news-list.tsx | 8 ++-- source/views/news/news-row.tsx | 6 ++- source/views/news/query.ts | 3 +- source/views/settings/components/logo.tsx | 8 ++-- source/views/settings/index.ts | 16 ++++---- .../settings/screens/api-test/api-test.tsx | 22 ++++++----- .../views/settings/screens/api-test/index.ts | 2 +- source/views/settings/screens/change-icon.tsx | 6 ++- source/views/settings/screens/credits.tsx | 7 +++- source/views/settings/screens/debug/list.tsx | 14 ++++--- source/views/settings/screens/debug/row.tsx | 1 + source/views/settings/screens/legal.tsx | 1 + .../settings/screens/network-logger/index.tsx | 13 ++++--- .../settings/screens/overview/app-icon.tsx | 2 + .../overview/component-library/badge.tsx | 6 ++- .../base/library-wrapper.tsx | 3 +- .../overview/component-library/button.tsx | 5 ++- .../overview/component-library/colors.tsx | 2 + .../component-library/context-menu.tsx | 4 +- .../overview/component-library/index.tsx | 11 +++--- .../overview/component-library/library.tsx | 7 ++-- .../settings/screens/overview/developer.tsx | 11 ++++-- .../views/settings/screens/overview/index.tsx | 11 +++--- .../screens/overview/login-button.tsx | 1 + .../screens/overview/login-credentials.tsx | 14 ++++--- .../settings/screens/overview/miscellany.tsx | 7 +++- .../settings/screens/overview/server-url.tsx | 9 +++-- .../settings/screens/overview/support.tsx | 12 ++++-- source/views/settings/screens/privacy.tsx | 1 + source/views/sis/balances-acknowledgement.tsx | 13 ++++--- source/views/sis/balances.tsx | 17 +++++---- source/views/sis/components/recents-list.tsx | 8 ++-- .../views/sis/course-search/detail/index.tsx | 29 +++++++------- source/views/sis/course-search/index.ts | 14 +++---- .../sis/course-search/lib/build-filters.ts | 3 +- .../sis/course-search/lib/execute-search.ts | 2 +- .../course-search/lib/format-filter-combo.ts | 5 ++- .../sis/course-search/lib/format-terms.ts | 2 +- source/views/sis/course-search/query.ts | 12 +++--- source/views/sis/course-search/results.tsx | 38 +++++++++---------- source/views/sis/course-search/row.tsx | 6 ++- source/views/sis/course-search/search.tsx | 15 +++++--- source/views/sis/index.tsx | 14 ++++--- .../views/sis/student-work/detail-android.tsx | 23 ++++++----- source/views/sis/student-work/detail-ios.tsx | 27 +++++++------ source/views/sis/student-work/detail.tsx | 10 ++--- source/views/sis/student-work/index.tsx | 15 +++++--- source/views/sis/student-work/job-row.tsx | 6 ++- source/views/sis/student-work/lib.ts | 1 + source/views/sis/student-work/query.ts | 5 ++- source/views/stoprint/components/error.tsx | 5 ++- source/views/stoprint/components/notice.tsx | 4 +- source/views/stoprint/index.ts | 12 +++--- source/views/stoprint/lib.ts | 5 ++- source/views/stoprint/print-jobs.tsx | 25 ++++++------ source/views/stoprint/print-release.tsx | 29 +++++++------- source/views/stoprint/printers.tsx | 19 ++++++---- source/views/stoprint/query.ts | 2 +- source/views/streaming/index.tsx | 14 ++++--- source/views/streaming/movie.tsx | 2 +- source/views/streaming/radio/buttons.tsx | 2 + source/views/streaming/radio/controller.tsx | 19 ++++++---- source/views/streaming/radio/index.ts | 2 +- source/views/streaming/radio/player.tsx | 4 +- source/views/streaming/radio/schedule.tsx | 1 + source/views/streaming/radio/station-krlx.tsx | 4 +- source/views/streaming/radio/station-ksto.tsx | 5 ++- source/views/streaming/radio/theme.ts | 2 +- source/views/streaming/streams/list.tsx | 18 +++++---- source/views/streaming/streams/query.ts | 5 ++- source/views/streaming/streams/row.tsx | 9 +++-- source/views/streaming/webcams/list.tsx | 11 ++++-- source/views/streaming/webcams/query.ts | 3 +- source/views/streaming/webcams/thumbnail.tsx | 9 +++-- source/views/student-orgs/detail-android.tsx | 17 +++++---- source/views/student-orgs/detail-ios.tsx | 19 ++++++---- source/views/student-orgs/detail.ts | 10 ++--- source/views/student-orgs/index.ts | 4 +- source/views/student-orgs/list.tsx | 31 ++++++++------- source/views/student-orgs/query.ts | 3 +- .../bus/components/bus-stop-row.tsx | 10 +++-- .../bus/components/progress-chunk.tsx | 4 +- .../transportation/bus/components/times.tsx | 2 +- .../__tests__/find-bus-stop-status.test.ts | 7 ++-- ...find-remaining-departures-for-stop.test.ts | 6 +-- .../get-current-bus-iteration.test.ts | 4 +- .../__tests__/get-schedule-for-now.test.ts | 4 +- .../bus/lib/__tests__/parse-time.test.ts | 2 +- .../lib/__tests__/process-bus-line.test.ts | 4 +- .../bus/lib/find-bus-stop-status.ts | 2 +- .../bus/lib/get-current-bus-iteration.ts | 2 +- source/views/transportation/bus/lib/index.ts | 11 +++--- .../transportation/bus/lib/parse-time.ts | 5 ++- .../bus/lib/process-bus-line.ts | 1 - source/views/transportation/bus/line.tsx | 16 ++++---- source/views/transportation/bus/map.tsx | 15 +++++--- source/views/transportation/bus/query.ts | 3 +- source/views/transportation/bus/types.ts | 3 +- source/views/transportation/bus/wrapper.tsx | 11 ++++-- source/views/transportation/index.tsx | 8 ++-- .../views/transportation/other-modes/list.tsx | 8 ++-- .../views/transportation/other-modes/query.ts | 3 +- .../views/transportation/other-modes/row.tsx | 6 ++- source/views/views.ts | 6 +-- 329 files changed, 1383 insertions(+), 1018 deletions(-) diff --git a/images/news-sources/index.ts b/images/news-sources/index.ts index 4c9df5f034..2544391ec2 100644 --- a/images/news-sources/index.ts +++ b/images/news-sources/index.ts @@ -1,5 +1,4 @@ export {ksto} from '../streaming' - export * as mess from './mess.png' export * as oleville from './oleville.png' export * as stolaf from './stolaf.png' diff --git a/images/spaces/index.ts b/images/spaces/index.ts index c4cf21e692..10170e7f17 100644 --- a/images/spaces/index.ts +++ b/images/spaces/index.ts @@ -11,8 +11,8 @@ import hallOfMusic from './optimized/hall-of-music.jpg' import halvorson from './optimized/halvorson.jpg' import oldMain from './optimized/old-main.jpg' import pauseKitchen from './optimized/pause-kitchen.jpg' -import print from './optimized/print.jpg' import postOffice from './optimized/post-office.jpg' +import print from './optimized/print.jpg' import regentsHall from './optimized/regents-hall.jpg' import regentsMath from './optimized/regents-math.jpg' import rolvaagLibrary from './optimized/rolvaag-library.jpg' diff --git a/images/webcams/index.ts b/images/webcams/index.ts index 9c0e143227..7f1fd241b7 100644 --- a/images/webcams/index.ts +++ b/images/webcams/index.ts @@ -1,9 +1,9 @@ import alumniwest from './alumniwest.jpg' import bcplaza from './bcplaza.jpg' import eastquad from './eastquad.jpg' +import oleave from './oleave.jpg' import tomsoneast from './tomsoneast.jpg' import tomsonwest from './tomsonwest.jpg' -import oleave from './oleave.jpg' export const images = new Map([ ['alumniwest', alumniwest], diff --git a/modules/add-to-device-calendar/add-to-calendar.ts b/modules/add-to-device-calendar/add-to-calendar.ts index 7a61036bed..51d623630b 100644 --- a/modules/add-to-device-calendar/add-to-calendar.ts +++ b/modules/add-to-device-calendar/add-to-calendar.ts @@ -1,5 +1,7 @@ import * as React from 'react' + import type {EventType} from '@frogpond/event-type' + import {addToCalendar} from './lib' import delay from 'delay' diff --git a/modules/add-to-device-calendar/lib.ts b/modules/add-to-device-calendar/lib.ts index 6725981d3e..d3891fe84a 100644 --- a/modules/add-to-device-calendar/lib.ts +++ b/modules/add-to-device-calendar/lib.ts @@ -1,8 +1,11 @@ -import * as Sentry from '@sentry/react-native' -import type {EventType} from '@frogpond/event-type' -import RNCalendarEvents from 'react-native-calendar-events' import {Alert, Linking, Platform} from 'react-native' +import RNCalendarEvents from 'react-native-calendar-events' + +import type {EventType} from '@frogpond/event-type' + +import * as Sentry from '@sentry/react-native' + export async function addToCalendar(event: EventType): Promise { try { const authCode = await RNCalendarEvents.checkPermissions(false) diff --git a/modules/app-theme/index.ts b/modules/app-theme/index.ts index d8b6a1ab1e..b88ae75a73 100644 --- a/modules/app-theme/index.ts +++ b/modules/app-theme/index.ts @@ -1,7 +1,7 @@ // import type {ThemingType} from '@callstack/react-theme-provider' // import {createTheming} from '@callstack/react-theme-provider' import {useTheme} from '@react-navigation/native' -export {CombinedLightTheme, CombinedDarkTheme} from './paper' +export {CombinedDarkTheme, CombinedLightTheme} from './paper' export type AppTheme = { accent: string diff --git a/modules/app-theme/paper.ts b/modules/app-theme/paper.ts index 927bde0352..18a59dfa13 100644 --- a/modules/app-theme/paper.ts +++ b/modules/app-theme/paper.ts @@ -1,14 +1,14 @@ -import merge from 'deepmerge' +import { + MD3DarkTheme as PaperDarkTheme, + MD3LightTheme as PaperLightTheme, +} from 'react-native-paper' import { DarkTheme as NavigationDarkTheme, DefaultTheme as NavigationLightTheme, } from '@react-navigation/native' -import { - MD3DarkTheme as PaperDarkTheme, - MD3LightTheme as PaperLightTheme, -} from 'react-native-paper' +import merge from 'deepmerge' export const CombinedLightTheme = merge(PaperLightTheme, NavigationLightTheme) diff --git a/modules/badge/outline.tsx b/modules/badge/outline.tsx index 5f4a0df860..04bb6da358 100644 --- a/modules/badge/outline.tsx +++ b/modules/badge/outline.tsx @@ -8,6 +8,7 @@ import { View, ViewStyle, } from 'react-native' + import * as c from '@frogpond/colors' type Props = { diff --git a/modules/badge/solid.tsx b/modules/badge/solid.tsx index 29728e1e4d..dc4050263b 100644 --- a/modules/badge/solid.tsx +++ b/modules/badge/solid.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {ColorValue, Platform, StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' type Props = { diff --git a/modules/button/index.tsx b/modules/button/index.tsx index bd3c136cd0..a3dfb424be 100644 --- a/modules/button/index.tsx +++ b/modules/button/index.tsx @@ -6,11 +6,14 @@ import { TextStyle, ViewStyle, } from 'react-native' + import BasicButton from 'react-native-button' -import noop from 'lodash/noop' import {iOSUIKit, material} from 'react-native-typography' + import * as c from '@frogpond/colors' +import noop from 'lodash/noop' + const styles = StyleSheet.create({ button: { alignSelf: 'center', diff --git a/modules/ccc-calendar/index.tsx b/modules/ccc-calendar/index.tsx index 5fb9f1bdff..52d1833dab 100644 --- a/modules/ccc-calendar/index.tsx +++ b/modules/ccc-calendar/index.tsx @@ -1,15 +1,17 @@ +import * as React from 'react' + import {EventList, type PoweredBy} from '@frogpond/event-list' import type {EventType} from '@frogpond/event-type' import {NoticeView} from '@frogpond/notice' import {useMomentTimer} from '@frogpond/timer' + import {UseQueryResult} from '@tanstack/react-query' -import * as React from 'react' export { - useNamedCalendar, useGoogleCalendar, - useReasonCalendar, useIcsCalendar, + useNamedCalendar, + useReasonCalendar, } from './query' type Props = { diff --git a/modules/ccc-calendar/query.ts b/modules/ccc-calendar/query.ts index 092e2668e3..95ed7cb804 100644 --- a/modules/ccc-calendar/query.ts +++ b/modules/ccc-calendar/query.ts @@ -1,13 +1,14 @@ import {client} from '@frogpond/api' import {EventType} from '@frogpond/event-type' -import {useQuery, type UseQueryResult} from '@tanstack/react-query' -import moment from 'moment' + import { GoogleCalendar, IcsCalendar, NamedCalendar, ReasonCalendar, } from './types' +import {useQuery, type UseQueryResult} from '@tanstack/react-query' +import moment from 'moment' export const keys = { named: (name: string) => ['calendar', 'named', name] as const, diff --git a/modules/colors/index.ts b/modules/colors/index.ts index 4cfc70c062..8879c92b4c 100644 --- a/modules/colors/index.ts +++ b/modules/colors/index.ts @@ -1,5 +1,4 @@ -export {firstReadable} from './util' - export * from './colors' export * from './gradients' export * from './platform' +export {firstReadable} from './util' diff --git a/modules/colors/platform.ts b/modules/colors/platform.ts index 3858b7f981..2df82bc8f4 100644 --- a/modules/colors/platform.ts +++ b/modules/colors/platform.ts @@ -1,4 +1,4 @@ -import {PlatformColor, Platform, OpaqueColorValue} from 'react-native' +import {OpaqueColorValue, Platform, PlatformColor} from 'react-native' // MARK: Label colors diff --git a/modules/colors/util.ts b/modules/colors/util.ts index bde007cfc0..f8863f095d 100644 --- a/modules/colors/util.ts +++ b/modules/colors/util.ts @@ -1,5 +1,5 @@ -import tinycolor from 'tinycolor2' import {black, white} from './colors' +import tinycolor from 'tinycolor2' /** * Given a background and a set of foreground colors, returns the first diff --git a/modules/context-menu/index.tsx b/modules/context-menu/index.tsx index 3b957319e6..d21b472e8c 100644 --- a/modules/context-menu/index.tsx +++ b/modules/context-menu/index.tsx @@ -1,7 +1,10 @@ import React from 'react' import {StyleProp, ViewStyle} from 'react-native' -import {Touchable} from '@frogpond/touchable' + import {ContextMenuButton} from 'react-native-ios-context-menu' + +import {Touchable} from '@frogpond/touchable' + import {upperFirst} from 'lodash' interface ContextMenuProps { diff --git a/modules/datepicker/basepicker.tsx b/modules/datepicker/basepicker.tsx index ab94ad87a7..501a241d41 100644 --- a/modules/datepicker/basepicker.tsx +++ b/modules/datepicker/basepicker.tsx @@ -1,15 +1,13 @@ import * as React from 'react' import {Button} from 'react-native' -import type {Moment} from 'moment-timezone' -import moment from 'moment-timezone' - +import {BaseDatetimePickerProps} from './types' import { DateTimePickerEvent, default as DateTimePicker, } from '@react-native-community/datetimepicker' - -import {BaseDatetimePickerProps} from './types' +import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' const FORMATS = { date: 'YYYY-MM-DD', diff --git a/modules/datepicker/datepicker-android.tsx b/modules/datepicker/datepicker-android.tsx index 2e4acc00f3..85441c0f4f 100644 --- a/modules/datepicker/datepicker-android.tsx +++ b/modules/datepicker/datepicker-android.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {BaseDateTimePicker} from './basepicker' import {AndroidDatetimePickerProps} from './types' diff --git a/modules/datepicker/datepicker-ios.tsx b/modules/datepicker/datepicker-ios.tsx index 1bb7350478..6de9a31529 100644 --- a/modules/datepicker/datepicker-ios.tsx +++ b/modules/datepicker/datepicker-ios.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {StyleSheet} from 'react-native' + import {BaseDateTimePicker} from './basepicker' import {IosDatetimePickerProps} from './types' diff --git a/modules/datepicker/datepicker.ts b/modules/datepicker/datepicker.ts index 507bebf3b8..f599d39e66 100644 --- a/modules/datepicker/datepicker.ts +++ b/modules/datepicker/datepicker.ts @@ -1,7 +1,7 @@ import {Platform} from 'react-native' -import {DatePicker as IosDatePicker} from './datepicker-ios' import {DatePicker as AndroidDatePicker} from './datepicker-android' +import {DatePicker as IosDatePicker} from './datepicker-ios' export const DatePicker = Platform.OS === 'ios' ? IosDatePicker : AndroidDatePicker diff --git a/modules/datepicker/types.ts b/modules/datepicker/types.ts index 8d83590940..58ccc8733d 100644 --- a/modules/datepicker/types.ts +++ b/modules/datepicker/types.ts @@ -1,10 +1,11 @@ import * as React from 'react' import {StyleProp, ViewStyle} from 'react-native' -import type {Moment} from 'moment-timezone' + import type { AndroidNativeProps, IOSNativeProps, } from '@react-native-community/datetimepicker' +import type {Moment} from 'moment-timezone' export interface BaseDatetimePickerProps { // dep-specific diff --git a/modules/event-list/__tests__/times.test.ts b/modules/event-list/__tests__/times.test.ts index 01685331d8..4121f34287 100644 --- a/modules/event-list/__tests__/times.test.ts +++ b/modules/event-list/__tests__/times.test.ts @@ -1,8 +1,8 @@ -import {describe, expect, test} from '@jest/globals' - import type {EventType} from '@frogpond/event-type' -import moment from 'moment' + import {detailTimes, times} from '../times' +import {describe, expect, test} from '@jest/globals' +import moment from 'moment' describe('allDay', () => { function generateEvent(start: string, end: string): EventType { diff --git a/modules/event-list/calendar-util.ts b/modules/event-list/calendar-util.ts index 0b93883127..c776321ec4 100644 --- a/modules/event-list/calendar-util.ts +++ b/modules/event-list/calendar-util.ts @@ -1,6 +1,7 @@ import {Share, ShareAction} from 'react-native' import type {EventType} from '@frogpond/event-type' + import {detailTimes} from './times' export function shareEvent(event: EventType): Promise { diff --git a/modules/event-list/event-detail-android.tsx b/modules/event-list/event-detail-android.tsx index d7e8914189..63db121ea6 100644 --- a/modules/event-list/event-detail-android.tsx +++ b/modules/event-list/event-detail-android.tsx @@ -1,17 +1,20 @@ import * as React from 'react' import {ScrollView, StyleSheet, Text} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {AddToCalendar} from '@frogpond/add-to-device-calendar' +import * as c from '@frogpond/colors' +import {EventType} from '@frogpond/event-type' +import {ListFooter} from '@frogpond/lists' import {openUrl} from '@frogpond/open-url' import {Card} from '@frogpond/silly-card' -import * as c from '@frogpond/colors' import {ButtonCell} from '@frogpond/tableview/cells' -import {getTimes} from './calendar-util' -import {AddToCalendar} from '@frogpond/add-to-device-calendar' -import {ListFooter} from '@frogpond/lists' -import {RouteProp, useRoute} from '@react-navigation/native' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {RootStackParamList} from '../../source/navigation/types' +import {getTimes} from './calendar-util' import {NavigationKey} from './event-detail-base' -import {EventType} from '@frogpond/event-type' const styles = StyleSheet.create({ name: { diff --git a/modules/event-list/event-detail-ios.tsx b/modules/event-list/event-detail-ios.tsx index 152f3688ef..99d52efa81 100644 --- a/modules/event-list/event-detail-ios.tsx +++ b/modules/event-list/event-detail-ios.tsx @@ -1,14 +1,17 @@ import * as React from 'react' import {ScrollView} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {AddToCalendar} from '@frogpond/add-to-device-calendar' +import {ListFooter} from '@frogpond/lists' +import {ShareButton} from '@frogpond/navigation-buttons' import {Section, TableView} from '@frogpond/tableview' import {ButtonCell, SelectableCell} from '@frogpond/tableview/cells' -import {ShareButton} from '@frogpond/navigation-buttons' -import {ListFooter} from '@frogpond/lists' -import {getTimes, shareEvent} from './calendar-util' -import {AddToCalendar} from '@frogpond/add-to-device-calendar' -import {RouteProp, useRoute} from '@react-navigation/native' + import {RootStackParamList} from '../../source/navigation/types' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import {getTimes, shareEvent} from './calendar-util' import {NavigationKey} from './event-detail-base' function MaybeSection({header, content}: {header: string; content: string}) { diff --git a/modules/event-list/event-detail.tsx b/modules/event-list/event-detail.tsx index f68e77f589..bd1df324b4 100644 --- a/modules/event-list/event-detail.tsx +++ b/modules/event-list/event-detail.tsx @@ -1,14 +1,15 @@ import {Platform} from 'react-native' -import { - EventDetail as IosEventDetail, - NavigationOptions as IOSDetailNavigationOptions, -} from './event-detail-ios' +import {EventType} from '@frogpond/event-type' + import { EventDetail as AndroidEventDetail, NavigationOptions as AndroidDetailNavigationOptions, } from './event-detail-android' -import {EventType} from '@frogpond/event-type' +import { + EventDetail as IosEventDetail, + NavigationOptions as IOSDetailNavigationOptions, +} from './event-detail-ios' import {PoweredBy} from './types' export const EventDetailNavigationOptions = diff --git a/modules/event-list/event-list.tsx b/modules/event-list/event-list.tsx index 9d96cb1d89..cc253439bf 100644 --- a/modules/event-list/event-list.tsx +++ b/modules/event-list/event-list.tsx @@ -1,15 +1,18 @@ import * as React from 'react' -import {StyleSheet, SectionList} from 'react-native' +import {SectionList, StyleSheet} from 'react-native' + +import {useNavigation} from '@react-navigation/native' + import * as c from '@frogpond/colors' -import toPairs from 'lodash/toPairs' import type {EventType} from '@frogpond/event-type' -import groupBy from 'lodash/groupBy' -import type {Moment} from 'moment-timezone' import {FullWidthSeparator, ListSectionHeader} from '@frogpond/lists' import {NoticeView} from '@frogpond/notice' + import EventRow from './event-row' -import {useNavigation} from '@react-navigation/native' import {PoweredBy} from './types' +import groupBy from 'lodash/groupBy' +import toPairs from 'lodash/toPairs' +import type {Moment} from 'moment-timezone' type Props = { detailView?: string diff --git a/modules/event-list/event-row.tsx b/modules/event-list/event-row.tsx index 5ae976764b..d4dd28c6d5 100644 --- a/modules/event-list/event-row.tsx +++ b/modules/event-list/event-row.tsx @@ -1,11 +1,13 @@ import * as React from 'react' import {StyleProp, StyleSheet, Text, ViewStyle} from 'react-native' -import type {EventType} from '@frogpond/event-type' + import * as c from '@frogpond/colors' +import type {EventType} from '@frogpond/event-type' import {Column, Row} from '@frogpond/layout' import {Detail, ListRow, Title} from '@frogpond/lists' -import {Bar} from './vertical-bar' + import {times} from './times' +import {Bar} from './vertical-bar' const styles = StyleSheet.create({ row: { diff --git a/modules/event-list/index.ts b/modules/event-list/index.ts index 7b0b0c1cf3..c9f977040f 100644 --- a/modules/event-list/index.ts +++ b/modules/event-list/index.ts @@ -1,4 +1,3 @@ -export type {PoweredBy} from './types' - -export * as EventList from './event-list' export * as EventDetail from './event-detail' +export * as EventList from './event-list' +export type {PoweredBy} from './types' diff --git a/modules/event-list/times.ts b/modules/event-list/times.ts index 91c837a811..e64e9da17f 100644 --- a/modules/event-list/times.ts +++ b/modules/event-list/times.ts @@ -1,6 +1,7 @@ -import moment from 'moment-timezone' -import type {EventType} from '@frogpond/event-type' import type {EventDetailTime} from '@frogpond/event-list/types' +import type {EventType} from '@frogpond/event-type' + +import moment from 'moment-timezone' export function times(event: EventType): EventDetailTime { let eventLength = moment diff --git a/modules/event-list/types.ts b/modules/event-list/types.ts index 62005b34d9..ed674730c2 100644 --- a/modules/event-list/types.ts +++ b/modules/event-list/types.ts @@ -1,4 +1,5 @@ import type {EventType} from '@frogpond/event-type' + import type {Moment} from 'moment-timezone' export interface PoweredBy { diff --git a/modules/event-list/vertical-bar.tsx b/modules/event-list/vertical-bar.tsx index cde5934e50..4898f1494d 100644 --- a/modules/event-list/vertical-bar.tsx +++ b/modules/event-list/vertical-bar.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {Platform, StyleProp, StyleSheet, View, ViewStyle} from 'react-native' + import * as c from '@frogpond/colors' const dotBarStyles = StyleSheet.create({ diff --git a/modules/filter/__tests__/apply-and-list-filter.test.ts b/modules/filter/__tests__/apply-and-list-filter.test.ts index 1caf908563..5156418db5 100644 --- a/modules/filter/__tests__/apply-and-list-filter.test.ts +++ b/modules/filter/__tests__/apply-and-list-filter.test.ts @@ -1,6 +1,6 @@ -import {expect, it} from '@jest/globals' import {applyAndListFilter} from '../apply-filters' import {filterValue} from './filter-value.helper' +import {expect, it} from '@jest/globals' it("should return `true` if the item's value is a superset of the needle", () => { expect(applyAndListFilter(filterValue('1'), ['1', '2'])).toBeTruthy() diff --git a/modules/filter/__tests__/apply-filter.test.ts b/modules/filter/__tests__/apply-filter.test.ts index 2e04d02e49..d334a918e7 100644 --- a/modules/filter/__tests__/apply-filter.test.ts +++ b/modules/filter/__tests__/apply-filter.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' import {applyFilter} from '../apply-filters' -import {filterValue} from './filter-value.helper' import type {FilterType} from '../types' +import {filterValue} from './filter-value.helper' +import {expect, it} from '@jest/globals' it('should return `true` if the filter is disabled', () => { let filter: FilterType<{categories: string[]}> = { diff --git a/modules/filter/__tests__/apply-or-list-filter.test.ts b/modules/filter/__tests__/apply-or-list-filter.test.ts index 21956ebf3c..e2b7e181ec 100644 --- a/modules/filter/__tests__/apply-or-list-filter.test.ts +++ b/modules/filter/__tests__/apply-or-list-filter.test.ts @@ -1,6 +1,6 @@ -import {expect, it} from '@jest/globals' import {applyOrListFilter} from '../apply-filters' import {filterValue} from './filter-value.helper' +import {expect, it} from '@jest/globals' it("should return `true` if the item's value contains the needle", () => { expect(applyOrListFilter(filterValue('1', '2', '3'), ['1'])).toBeTruthy() diff --git a/modules/filter/__tests__/apply-toggle-filter.test.ts b/modules/filter/__tests__/apply-toggle-filter.test.ts index 186e1ebd4c..1611616746 100644 --- a/modules/filter/__tests__/apply-toggle-filter.test.ts +++ b/modules/filter/__tests__/apply-toggle-filter.test.ts @@ -1,6 +1,6 @@ -import {expect, it} from '@jest/globals' import {applyToggleFilter} from '../apply-filters' import type {FilterType} from '../types' +import {expect, it} from '@jest/globals' it('should return `true` if the item has a truthy value', () => { let item = {'i-am-a-key': true} diff --git a/modules/filter/active-filter-button.tsx b/modules/filter/active-filter-button.tsx index 35928639e1..486b833d55 100644 --- a/modules/filter/active-filter-button.tsx +++ b/modules/filter/active-filter-button.tsx @@ -1,5 +1,4 @@ import * as React from 'react' -import type {FilterType} from './types' import { Platform, StyleProp, @@ -9,9 +8,13 @@ import { View, ViewStyle, } from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' + import * as c from '@frogpond/colors' +import type {FilterType} from './types' + type Props = { filter: FilterType label: string diff --git a/modules/filter/apply-filters.ts b/modules/filter/apply-filters.ts index 1dcaded297..12916f0e48 100644 --- a/modules/filter/apply-filters.ts +++ b/modules/filter/apply-filters.ts @@ -1,7 +1,7 @@ -import type {FilterType, ToggleType, ListType, ListItemSpecType} from './types' +import type {FilterType, ListItemSpecType, ListType, ToggleType} from './types' +import {isPlainObject, values} from 'lodash' import difference from 'lodash/difference' import intersection from 'lodash/intersection' -import {isPlainObject, values} from 'lodash' export function applyFiltersToItem( filters: FilterType[], diff --git a/modules/filter/filter-popover.tsx b/modules/filter/filter-popover.tsx index 4a72666e36..928ce4355f 100644 --- a/modules/filter/filter-popover.tsx +++ b/modules/filter/filter-popover.tsx @@ -1,12 +1,15 @@ import React, {useState} from 'react' +import {StyleSheet, View} from 'react-native' + import Popover, {PopoverPlacement} from 'react-native-popover-view' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {FilterSection} from './section' -import type {FilterType} from './types' + import * as c from '@frogpond/colors' -import {View, StyleSheet} from 'react-native' import {TableView} from '@frogpond/tableview' +import {FilterSection} from './section' +import type {FilterType} from './types' + type Props = { anchor: React.RefObject filter: FilterType diff --git a/modules/filter/filter-toolbar-button.tsx b/modules/filter/filter-toolbar-button.tsx index 38df126be5..642c2bef5c 100644 --- a/modules/filter/filter-toolbar-button.tsx +++ b/modules/filter/filter-toolbar-button.tsx @@ -8,12 +8,15 @@ import { View, ViewStyle, } from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' -import type {FilterType} from './types' -import {FilterPopover} from './filter-popover' + import * as c from '@frogpond/colors' import {Touchable} from '@frogpond/touchable' +import {FilterPopover} from './filter-popover' +import type {FilterType} from './types' + const buttonStyles = StyleSheet.create({ button: { flexDirection: 'row', diff --git a/modules/filter/filter-toolbar.tsx b/modules/filter/filter-toolbar.tsx index 2f8ad089ef..67e5533c7b 100644 --- a/modules/filter/filter-toolbar.tsx +++ b/modules/filter/filter-toolbar.tsx @@ -1,11 +1,13 @@ import * as React from 'react' -import type {FilterType, ListItemSpecType, ListType, ToggleType} from './types' import {ScrollView, StyleSheet} from 'react-native' + import {Toolbar} from '@frogpond/toolbar' -import {FilterToolbarButton} from './filter-toolbar-button' + import {ActiveFilterButton} from './active-filter-button' -import flatten from 'lodash/flatten' +import {FilterToolbarButton} from './filter-toolbar-button' +import type {FilterType, ListItemSpecType, ListType, ToggleType} from './types' import cloneDeep from 'lodash/cloneDeep' +import flatten from 'lodash/flatten' type Props = { filters: Array> diff --git a/modules/filter/index.ts b/modules/filter/index.ts index a51f64e8c1..77502e9468 100644 --- a/modules/filter/index.ts +++ b/modules/filter/index.ts @@ -1,7 +1,7 @@ -export type {FilterType, ListType, ToggleType, PickerType} from './types' export {applyFiltersToItem} from './apply-filters' -export {stringifyFilters} from './stringify-filters' -export {filterListSpecs, filterPickerSpecs, filterToggleSpecs} from './tools' -export {FilterToolbar} from './filter-toolbar' export {FilterPopover} from './filter-popover' +export {FilterToolbar} from './filter-toolbar' export {FilterToolbarButton} from './filter-toolbar-button' +export {stringifyFilters} from './stringify-filters' +export {filterListSpecs, filterPickerSpecs, filterToggleSpecs} from './tools' +export type {FilterType, ListType, PickerType, ToggleType} from './types' diff --git a/modules/filter/section-list.tsx b/modules/filter/section-list.tsx index 2f62a330cd..2b0be9bec6 100644 --- a/modules/filter/section-list.tsx +++ b/modules/filter/section-list.tsx @@ -1,14 +1,15 @@ +import * as React from 'react' +import {useCallback} from 'react' import {Image, StyleSheet, Text} from 'react-native' -import type {ListItemSpecType, ListType} from './types' -import {Cell, Section} from '@frogpond/tableview' -import {Column} from '@frogpond/layout' + import * as c from '@frogpond/colors' +import {Column} from '@frogpond/layout' +import {Cell, Section} from '@frogpond/tableview' +import type {ListItemSpecType, ListType} from './types' import concat from 'lodash/concat' import isEqual from 'lodash/isEqual' import reject from 'lodash/reject' -import * as React from 'react' -import {useCallback} from 'react' type Props = { filter: ListType diff --git a/modules/filter/section-picker.tsx b/modules/filter/section-picker.tsx index 487f887a8f..70d2ece82f 100644 --- a/modules/filter/section-picker.tsx +++ b/modules/filter/section-picker.tsx @@ -1,8 +1,10 @@ import * as React from 'react' import {StyleSheet} from 'react-native' + import * as c from '@frogpond/colors' -import type {PickerType} from './types' import {Section} from '@frogpond/tableview' + +import type {PickerType} from './types' import {Picker} from '@react-native-picker/picker' type Props = { diff --git a/modules/filter/section-toggle.tsx b/modules/filter/section-toggle.tsx index 5e535673ba..f5e66da00a 100644 --- a/modules/filter/section-toggle.tsx +++ b/modules/filter/section-toggle.tsx @@ -1,8 +1,10 @@ import * as React from 'react' -import type {ToggleType} from './types' + import {Section} from '@frogpond/tableview' import {CellToggle} from '@frogpond/tableview/cells' +import type {ToggleType} from './types' + type Props = { filter: ToggleType onChange: (filterSpec: ToggleType) => void diff --git a/modules/filter/section.tsx b/modules/filter/section.tsx index 1a7bfc5ce5..e26e840385 100644 --- a/modules/filter/section.tsx +++ b/modules/filter/section.tsx @@ -1,9 +1,10 @@ import * as React from 'react' import {ScrollView} from 'react-native' -import type {FilterType} from './types' -import {SingleToggleSection} from './section-toggle' + import {ListSection} from './section-list' import {PickerSection} from './section-picker' +import {SingleToggleSection} from './section-toggle' +import type {FilterType} from './types' type Props = { filter: FilterType diff --git a/modules/food-menu/dietary-tags-detail.tsx b/modules/food-menu/dietary-tags-detail.tsx index 14cb90821b..0df9048935 100644 --- a/modules/food-menu/dietary-tags-detail.tsx +++ b/modules/food-menu/dietary-tags-detail.tsx @@ -1,7 +1,9 @@ import * as React from 'react' import {Image, StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native' -import {Row} from '@frogpond/layout' + import * as c from '@frogpond/colors' +import {Row} from '@frogpond/layout' + import type {ItemCorIconMapType, MasterCorIconMapType} from './types' const styles = StyleSheet.create({ diff --git a/modules/food-menu/fancy-menu.tsx b/modules/food-menu/fancy-menu.tsx index 1ca546e40d..424ba27e19 100644 --- a/modules/food-menu/fancy-menu.tsx +++ b/modules/food-menu/fancy-menu.tsx @@ -1,7 +1,19 @@ import * as React from 'react' import {useEffect, useState} from 'react' import {SectionList, StyleSheet} from 'react-native' + +import {useNavigation} from '@react-navigation/native' + import * as c from '@frogpond/colors' +import type {FilterType} from '@frogpond/filter' +import {applyFiltersToItem} from '@frogpond/filter' +import {largeListProps, ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {NoticeView} from '@frogpond/notice' + +import {FilterMenuToolbar as FilterToolbar} from './filter-menu-toolbar' +import {FoodItemRow} from './food-item-row' +import {buildFilters} from './lib/build-filters' +import {chooseMeal} from './lib/choose-meal' import type { MasterCorIconMapType, MenuItemContainerType, @@ -10,15 +22,6 @@ import type { StationMenuType, } from './types' import size from 'lodash/size' -import {ListSectionHeader, ListSeparator, largeListProps} from '@frogpond/lists' -import type {FilterType} from '@frogpond/filter' -import {applyFiltersToItem} from '@frogpond/filter' -import {NoticeView} from '@frogpond/notice' -import {FilterMenuToolbar as FilterToolbar} from './filter-menu-toolbar' -import {FoodItemRow} from './food-item-row' -import {chooseMeal} from './lib/choose-meal' -import {buildFilters} from './lib/build-filters' -import {useNavigation} from '@react-navigation/native' import type {Moment} from 'moment' type FilterFunc = ( diff --git a/modules/food-menu/filter-menu-toolbar.tsx b/modules/food-menu/filter-menu-toolbar.tsx index 05185ed8bb..dcd25aef9e 100644 --- a/modules/food-menu/filter-menu-toolbar.tsx +++ b/modules/food-menu/filter-menu-toolbar.tsx @@ -1,10 +1,12 @@ import * as React from 'react' import {StyleSheet, Text, View} from 'react-native' -import type {Moment} from 'moment' + +import * as c from '@frogpond/colors' import type {FilterType} from '@frogpond/filter' import {FilterToolbar, FilterToolbarButton} from '@frogpond/filter' import {Toolbar} from '@frogpond/toolbar' -import * as c from '@frogpond/colors' + +import type {Moment} from 'moment' const styles = StyleSheet.create({ today: { diff --git a/modules/food-menu/food-item-detail.tsx b/modules/food-menu/food-item-detail.tsx index 524c0b8fe1..61a6b7029c 100644 --- a/modules/food-menu/food-item-detail.tsx +++ b/modules/food-menu/food-item-detail.tsx @@ -1,15 +1,18 @@ import * as React from 'react' import {ScrollView, StyleSheet, Text} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' import {Column, Row} from '@frogpond/layout' import {Detail, ListRow, ListSeparator, Title} from '@frogpond/lists' -import * as c from '@frogpond/colors' -import map from 'lodash/map' + +import {RootStackParamList} from '../../source/navigation/types' import {DietaryTagsDetail} from './dietary-tags-detail' import {calculateAmount} from './lib/calculate-amount' +import map from 'lodash/map' import size from 'lodash/size' -import {RouteProp, useRoute} from '@react-navigation/native' -import {RootStackParamList} from '../../source/navigation/types' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' export const DetailNavigationOptions: NativeStackNavigationOptions = { title: 'Nutrition', diff --git a/modules/food-menu/food-item-row.tsx b/modules/food-menu/food-item-row.tsx index d5f57e88bd..23995bd91b 100644 --- a/modules/food-menu/food-item-row.tsx +++ b/modules/food-menu/food-item-row.tsx @@ -1,11 +1,14 @@ import * as React from 'react' import {Platform, StyleProp, StyleSheet, View, ViewStyle} from 'react-native' -import {DietaryTags} from './dietary-tags' + +import Icon from 'react-native-vector-icons/Ionicons' + +import * as c from '@frogpond/colors' import {Column, Row} from '@frogpond/layout' import {Detail, ListRow, Title} from '@frogpond/lists' + +import {DietaryTags} from './dietary-tags' import type {MasterCorIconMapType, MenuItemType} from './types' -import * as c from '@frogpond/colors' -import Icon from 'react-native-vector-icons/Ionicons' const specialsIcon = Platform.OS === 'ios' ? 'ios-star' : 'md-star' diff --git a/modules/food-menu/index.ts b/modules/food-menu/index.ts index 1c0be6b9ce..7da6eab4ad 100644 --- a/modules/food-menu/index.ts +++ b/modules/food-menu/index.ts @@ -1,13 +1,12 @@ export {FancyMenu as FoodMenu} from './fancy-menu' - export type { - MenuItemType, - StationMenuType, CorIconType, - MenuItemContainerType, + DayPartMenuType, + DayPartsCollectionType, ItemCorIconMapType, MasterCorIconMapType, + MenuItemContainerType, + MenuItemType, ProcessedMealType, - DayPartsCollectionType, - DayPartMenuType, + StationMenuType, } from './types' diff --git a/modules/food-menu/lib/build-filters.ts b/modules/food-menu/lib/build-filters.ts index 1c19d6e76d..a826eb53ff 100644 --- a/modules/food-menu/lib/build-filters.ts +++ b/modules/food-menu/lib/build-filters.ts @@ -1,9 +1,3 @@ -import type {Moment} from 'moment' -import type { - MasterCorIconMapType, - MenuItemType, - ProcessedMealType, -} from '../types' import type { FilterType, ListType, @@ -11,7 +5,14 @@ import type { ToggleType, } from '@frogpond/filter/types' import {decode, fastGetTrimmedText} from '@frogpond/html-lib' + +import type { + MasterCorIconMapType, + MenuItemType, + ProcessedMealType, +} from '../types' import {chooseMeal, EMPTY_MEAL} from './choose-meal' +import type {Moment} from 'moment' export function buildFilters( foodItems: MenuItemType[], diff --git a/modules/food-menu/lib/choose-meal.ts b/modules/food-menu/lib/choose-meal.ts index 5d97c34743..c921ebdd72 100644 --- a/modules/food-menu/lib/choose-meal.ts +++ b/modules/food-menu/lib/choose-meal.ts @@ -1,7 +1,8 @@ -import type {Moment} from 'moment' -import type {ProcessedMealType} from '../types' import type {FilterType, PickerType} from '@frogpond/filter' + +import type {ProcessedMealType} from '../types' import {findMeal} from './find-menu' +import type {Moment} from 'moment' export const EMPTY_MEAL: ProcessedMealType = { label: '', diff --git a/modules/food-menu/lib/find-menu.ts b/modules/food-menu/lib/find-menu.ts index 39261e42ac..d69730c195 100644 --- a/modules/food-menu/lib/find-menu.ts +++ b/modules/food-menu/lib/find-menu.ts @@ -1,12 +1,13 @@ -import type {Moment} from 'moment' -import moment from 'moment-timezone' -import findIndex from 'lodash/findIndex' import {timezone} from '@frogpond/constants' + import type { DayPartMenuType, DayPartsCollectionType, ProcessedMealType, } from '../types' +import findIndex from 'lodash/findIndex' +import type {Moment} from 'moment' +import moment from 'moment-timezone' export function findMenu( dayparts: DayPartsCollectionType, diff --git a/modules/html-content/index.tsx b/modules/html-content/index.tsx index a1f56fd2d0..175c1c8dea 100644 --- a/modules/html-content/index.tsx +++ b/modules/html-content/index.tsx @@ -1,7 +1,9 @@ import * as React from 'react' import {useCallback, useRef} from 'react' -import {WebView, WebViewNavigation} from 'react-native-webview' import type {StyleProp, ViewStyle} from 'react-native' + +import {WebView, WebViewNavigation} from 'react-native-webview' + import {canOpenUrl, openUrl} from '@frogpond/open-url' type Props = { diff --git a/modules/html-lib/index.ts b/modules/html-lib/index.ts index 0f60684712..29569cc6fa 100644 --- a/modules/html-lib/index.ts +++ b/modules/html-lib/index.ts @@ -1,10 +1,10 @@ -import {parseDocument} from 'htmlparser2' -import {textContent} from 'domutils' -import {AnyNode, Document} from 'domhandler' import cssSelect from 'css-select' +import {AnyNode, Document} from 'domhandler' +import {textContent} from 'domutils' +import {parseDocument} from 'htmlparser2' -export {textContent, cssSelect} -export {encode, decode} from 'html-entities' +export {cssSelect, textContent} +export {decode, encode} from 'html-entities' export function parseHtml(string: string): Document { return parseDocument(string, { diff --git a/modules/icon/index.ts b/modules/icon/index.ts index 4268f62c08..4c8e91b746 100644 --- a/modules/icon/index.ts +++ b/modules/icon/index.ts @@ -1,4 +1,3 @@ -export {Icon} from './source' -export type {Glyphs} from './source' - export {platformPrefixIconName} from './platform-prefix-icon-name' +export type {Glyphs} from './source' +export {Icon} from './source' diff --git a/modules/icon/platform-prefix-icon-name.ts b/modules/icon/platform-prefix-icon-name.ts index 66c2138290..a50e8bde2b 100644 --- a/modules/icon/platform-prefix-icon-name.ts +++ b/modules/icon/platform-prefix-icon-name.ts @@ -1,6 +1,7 @@ import {Platform} from 'react-native' -import {Icon} from './source' + import type {Glyphs} from './source' +import {Icon} from './source' export function platformPrefixIconName(name: string): Glyphs { const isAvailable = Icon.hasIcon(name) diff --git a/modules/icon/source.ts b/modules/icon/source.ts index 4f1f3db13d..a1bcdc6ee4 100644 --- a/modules/icon/source.ts +++ b/modules/icon/source.ts @@ -1,5 +1,5 @@ -import * as Ionicons from 'react-native-vector-icons/Ionicons' import IoniconsGlyphs from 'react-native-vector-icons/glyphmaps/Ionicons.json' +import * as Ionicons from 'react-native-vector-icons/Ionicons' type IoniconsGlyphKey = keyof typeof IoniconsGlyphs diff --git a/modules/info-header/index.tsx b/modules/info-header/index.tsx index 51a01d3ab7..c8e981f899 100644 --- a/modules/info-header/index.tsx +++ b/modules/info-header/index.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' const styles = StyleSheet.create({ diff --git a/modules/layout/index.ts b/modules/layout/index.ts index e8965eee4b..7cc8dec067 100644 --- a/modules/layout/index.ts +++ b/modules/layout/index.ts @@ -1,2 +1,2 @@ -export {Row} from './row' export {Column} from './column' +export {Row} from './row' diff --git a/modules/lists/disclosure-arrow.tsx b/modules/lists/disclosure-arrow.tsx index 8166b64a97..2298c154f0 100644 --- a/modules/lists/disclosure-arrow.tsx +++ b/modules/lists/disclosure-arrow.tsx @@ -1,8 +1,10 @@ import * as React from 'react' import {Platform, StyleProp, StyleSheet, View, ViewStyle} from 'react-native' -import * as c from '@frogpond/colors' + import Icon from 'react-native-vector-icons/Ionicons' +import * as c from '@frogpond/colors' + const arrowStyles = StyleSheet.create({ wrapper: { marginLeft: 10, diff --git a/modules/lists/index.ts b/modules/lists/index.ts index 4d72f4efa4..4a0aba4d50 100644 --- a/modules/lists/index.ts +++ b/modules/lists/index.ts @@ -1,8 +1,8 @@ +export {largeListProps} from './large-sectionlist-props' +export {emptyList, ListEmpty} from './list-empty' +export {ListFooter} from './list-footer' +export {Detail} from './list-item-detail' +export {Title} from './list-item-title' export {ListRow} from './list-row' export {ListSectionHeader} from './list-section-header' -export {ListSeparator, FullWidthSeparator} from './list-separator' -export {Title} from './list-item-title' -export {Detail} from './list-item-detail' -export {ListEmpty, emptyList} from './list-empty' -export {ListFooter} from './list-footer' -export {largeListProps} from './large-sectionlist-props' +export {FullWidthSeparator, ListSeparator} from './list-separator' diff --git a/modules/lists/list-empty.tsx b/modules/lists/list-empty.tsx index 5cb419a191..b204d7c074 100644 --- a/modules/lists/list-empty.tsx +++ b/modules/lists/list-empty.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {NoticeView} from '@frogpond/notice' type Props = { diff --git a/modules/lists/list-footer.tsx b/modules/lists/list-footer.tsx index 12a46926ab..e94c0094f6 100644 --- a/modules/lists/list-footer.tsx +++ b/modules/lists/list-footer.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {StyleSheet, Text} from 'react-native' + import * as c from '@frogpond/colors' const styles = StyleSheet.create({ diff --git a/modules/lists/list-item-detail.tsx b/modules/lists/list-item-detail.tsx index 29f0b76042..359b34ccbb 100644 --- a/modules/lists/list-item-detail.tsx +++ b/modules/lists/list-item-detail.tsx @@ -1,7 +1,8 @@ -import {Platform, StyleProp, StyleSheet, Text, TextStyle} from 'react-native' -import * as c from '@frogpond/colors' import * as React from 'react' import {PropsWithChildren} from 'react' +import {Platform, StyleProp, StyleSheet, Text, TextStyle} from 'react-native' + +import * as c from '@frogpond/colors' const FONT_SIZE = 14 const styles = StyleSheet.create({ diff --git a/modules/lists/list-item-title.tsx b/modules/lists/list-item-title.tsx index 0e3285b37e..b834a0a0d0 100644 --- a/modules/lists/list-item-title.tsx +++ b/modules/lists/list-item-title.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import {PropsWithChildren} from 'react' import {Platform, StyleProp, StyleSheet, Text, TextStyle} from 'react-native' + import * as c from '@frogpond/colors' const styles = StyleSheet.create({ diff --git a/modules/lists/list-row.tsx b/modules/lists/list-row.tsx index 40780499ef..d71c0484a7 100644 --- a/modules/lists/list-row.tsx +++ b/modules/lists/list-row.tsx @@ -1,9 +1,11 @@ import * as React from 'react' import {PropsWithChildren} from 'react' import {Platform, StyleProp, StyleSheet, View, ViewStyle} from 'react-native' + +import * as c from '@frogpond/colors' import {Touchable} from '@frogpond/touchable' + import {DisclosureArrow} from './disclosure-arrow' -import * as c from '@frogpond/colors' const styles = StyleSheet.create({ childWrapper: { diff --git a/modules/lists/list-section-header.tsx b/modules/lists/list-section-header.tsx index 0bf0292413..22fda3d1e8 100644 --- a/modules/lists/list-section-header.tsx +++ b/modules/lists/list-section-header.tsx @@ -8,6 +8,7 @@ import { View, ViewStyle, } from 'react-native' + import * as c from '@frogpond/colors' const styles = StyleSheet.create({ diff --git a/modules/lists/list-separator.tsx b/modules/lists/list-separator.tsx index 16ac59a2c9..1e336e3129 100644 --- a/modules/lists/list-separator.tsx +++ b/modules/lists/list-separator.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import {Platform, StyleProp, StyleSheet, ViewStyle} from 'react-native' + import {Separator} from '@frogpond/separator' const styles = StyleSheet.create({ diff --git a/modules/markdown/code.tsx b/modules/markdown/code.tsx index 2452ec6975..1bdbc6d7c8 100644 --- a/modules/markdown/code.tsx +++ b/modules/markdown/code.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {Text, StyleSheet, TextProps} from 'react-native' +import {StyleSheet, Text, TextProps} from 'react-native' const styles = StyleSheet.create({ code: {}, diff --git a/modules/markdown/formatting.tsx b/modules/markdown/formatting.tsx index 690d486f02..557a7e2c2f 100644 --- a/modules/markdown/formatting.tsx +++ b/modules/markdown/formatting.tsx @@ -1,9 +1,12 @@ import React from 'react' -import {Platform, Text, StyleSheet, TextProps} from 'react-native' -import {SelectableText} from './selectable' +import {Platform, StyleSheet, Text, TextProps} from 'react-native' + import {iOSUIKit, material} from 'react-native-typography' + import * as c from '@frogpond/colors' +import {SelectableText} from './selectable' + const styles = StyleSheet.create({ text: { ...Platform.select({ diff --git a/modules/markdown/heading.tsx b/modules/markdown/heading.tsx index 78d93989e3..3860cbe94a 100644 --- a/modules/markdown/heading.tsx +++ b/modules/markdown/heading.tsx @@ -1,9 +1,12 @@ import * as React from 'react' import {Platform, StyleSheet} from 'react-native' -import {SelectableText} from './selectable' + import {iOSUIKit, material} from 'react-native-typography' + import * as c from '@frogpond/colors' +import {SelectableText} from './selectable' + const styles = StyleSheet.create({ header: { marginTop: 8, diff --git a/modules/markdown/index.ts b/modules/markdown/index.ts index b56fbaa5b0..3bcab9bed7 100644 --- a/modules/markdown/index.ts +++ b/modules/markdown/index.ts @@ -1,5 +1,5 @@ +export {BlockQuote, Emph, Paragraph, Strong} from './formatting' export {Heading} from './heading' export {Link} from './link' -export {Paragraph, Strong, Emph, BlockQuote} from './formatting' -export {Markdown} from './markdown' export type {MarkdownProps} from './markdown' +export {Markdown} from './markdown' diff --git a/modules/markdown/link.tsx b/modules/markdown/link.tsx index f6a6fb4f58..d4aba16acf 100644 --- a/modules/markdown/link.tsx +++ b/modules/markdown/link.tsx @@ -1,9 +1,11 @@ import * as React from 'react' -import Clipboard from '@react-native-clipboard/clipboard' +import {StyleSheet, Text, TextProps} from 'react-native' + +import * as c from '@frogpond/colors' import {openUrl} from '@frogpond/open-url' + import {useActionSheet} from '@expo/react-native-action-sheet' -import * as c from '@frogpond/colors' -import {TextProps, StyleSheet, Text} from 'react-native' +import Clipboard from '@react-native-clipboard/clipboard' const styles = StyleSheet.create({ linkText: { diff --git a/modules/markdown/list.tsx b/modules/markdown/list.tsx index 6e058a4218..f7ee153e66 100644 --- a/modules/markdown/list.tsx +++ b/modules/markdown/list.tsx @@ -1,8 +1,10 @@ import * as React from 'react' -import {BaseText, Paragraph} from './formatting' -import {ViewProps, StyleProp, View, StyleSheet, ViewStyle} from 'react-native' +import {StyleProp, StyleSheet, View, ViewProps, ViewStyle} from 'react-native' + import * as c from '@frogpond/colors' +import {BaseText, Paragraph} from './formatting' + const styles = StyleSheet.create({ list: {}, listText: { diff --git a/modules/markdown/markdown.tsx b/modules/markdown/markdown.tsx index e6a9046d00..8f70ff02b0 100644 --- a/modules/markdown/markdown.tsx +++ b/modules/markdown/markdown.tsx @@ -1,28 +1,28 @@ import * as React from 'react' +import ReactMarkdown from 'react-markdown' import { + ImageStyle, StyleProp, + StyleSheet, + Text, TextProps, TextStyle, View, ViewProps, ViewStyle, - Text, - StyleSheet, - ImageStyle, } from 'react-native' -import ReactMarkdown from 'react-markdown' - -import propTypes from 'prop-types' -// eslint-disable-next-line @typescript-eslint/no-explicit-any -;(ReactMarkdown as any).propTypes.containerTagName = propTypes.func import * as c from '@frogpond/colors' -import {Paragraph, Strong, Emph, BlockQuote} from './formatting' + import {Code, CodeBlock} from './code' +import {BlockQuote, Emph, Paragraph, Strong} from './formatting' import {Heading} from './heading' -import {Link} from './link' import {Image} from './image' +import {Link} from './link' import {List, ListItem} from './list' +import propTypes from 'prop-types' +// eslint-disable-next-line @typescript-eslint/no-explicit-any +;(ReactMarkdown as any).propTypes.containerTagName = propTypes.func const styles = StyleSheet.create({ horizontalRule: { diff --git a/modules/navigation-buttons/close-screen.tsx b/modules/navigation-buttons/close-screen.tsx index 7225571de5..1bcec431a3 100644 --- a/modules/navigation-buttons/close-screen.tsx +++ b/modules/navigation-buttons/close-screen.tsx @@ -1,9 +1,12 @@ import * as React from 'react' -import {Text, Platform, StyleSheet, ViewStyle, StyleProp} from 'react-native' -import {Touchable} from '@frogpond/touchable' -import {commonStyles} from './styles' +import {Platform, StyleProp, StyleSheet, Text, ViewStyle} from 'react-native' + import {useNavigation} from '@react-navigation/native' + import {useTheme} from '@frogpond/app-theme' +import {Touchable} from '@frogpond/touchable' + +import {commonStyles} from './styles' type Props = { title?: string diff --git a/modules/navigation-buttons/debug.tsx b/modules/navigation-buttons/debug.tsx index 2b4eb6da6d..3dc88eac8a 100644 --- a/modules/navigation-buttons/debug.tsx +++ b/modules/navigation-buttons/debug.tsx @@ -1,8 +1,11 @@ import * as React from 'react' import {Alert, StyleSheet} from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' -import {Touchable} from '@frogpond/touchable' + import * as c from '@frogpond/colors' +import {Touchable} from '@frogpond/touchable' + import {rightButtonStyles as styles} from './styles' export const debugStyles = StyleSheet.create({ diff --git a/modules/navigation-buttons/favorite.tsx b/modules/navigation-buttons/favorite.tsx index 269a9fd32e..fac5bf3fb7 100644 --- a/modules/navigation-buttons/favorite.tsx +++ b/modules/navigation-buttons/favorite.tsx @@ -1,7 +1,10 @@ import * as React from 'react' import {Platform} from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' + import {Touchable} from '@frogpond/touchable' + import {rightButtonStyles as styles} from './styles' type Props = { diff --git a/modules/navigation-buttons/index.ts b/modules/navigation-buttons/index.ts index 722e06e0c5..ddae5173af 100644 --- a/modules/navigation-buttons/index.ts +++ b/modules/navigation-buttons/index.ts @@ -1,6 +1,6 @@ -export {ShareButton} from './share' export {CloseScreenButton} from './close-screen' -export {OpenSettingsButton} from './open-settings' -export {FavoriteButton} from './favorite' export {DebugNoticeButton} from './debug' +export {FavoriteButton} from './favorite' +export {OpenSettingsButton} from './open-settings' export {SearchButton} from './search' +export {ShareButton} from './share' diff --git a/modules/navigation-buttons/open-settings.tsx b/modules/navigation-buttons/open-settings.tsx index 286ef849e3..565f147da7 100644 --- a/modules/navigation-buttons/open-settings.tsx +++ b/modules/navigation-buttons/open-settings.tsx @@ -1,11 +1,14 @@ import * as React from 'react' -import {Touchable} from '@frogpond/touchable' -import {Icon, platformPrefixIconName} from '@frogpond/icon' -import * as c from '@frogpond/colors' -import {commonStyles, rightButtonStyles} from './styles' + import {useNavigation} from '@react-navigation/native' import {HeaderBackButtonProps} from '@react-navigation/native-stack/lib/typescript/src/types' +import * as c from '@frogpond/colors' +import {Icon, platformPrefixIconName} from '@frogpond/icon' +import {Touchable} from '@frogpond/touchable' + +import {commonStyles, rightButtonStyles} from './styles' + export function OpenSettingsButton(_props: HeaderBackButtonProps): JSX.Element { let navigation = useNavigation() diff --git a/modules/navigation-buttons/search.tsx b/modules/navigation-buttons/search.tsx index 07f06583be..33d19b568e 100644 --- a/modules/navigation-buttons/search.tsx +++ b/modules/navigation-buttons/search.tsx @@ -1,8 +1,11 @@ import * as React from 'react' import {Platform, StyleSheet, Text} from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' -import {Touchable} from '@frogpond/touchable' + import {useTheme} from '@frogpond/app-theme' +import {Touchable} from '@frogpond/touchable' + import {commonStyles, rightButtonStyles as styles} from './styles' type Props = { diff --git a/modules/navigation-buttons/share.tsx b/modules/navigation-buttons/share.tsx index 0967badc85..7d5fd81f92 100644 --- a/modules/navigation-buttons/share.tsx +++ b/modules/navigation-buttons/share.tsx @@ -1,6 +1,8 @@ import * as React from 'react' + import {Icon, platformPrefixIconName} from '@frogpond/icon' import {Touchable, TouchableProps} from '@frogpond/touchable' + import {rightButtonStyles as styles} from './styles' export function ShareButton( diff --git a/modules/navigation-buttons/styles.ts b/modules/navigation-buttons/styles.ts index 83f0e46860..a3c2b24940 100644 --- a/modules/navigation-buttons/styles.ts +++ b/modules/navigation-buttons/styles.ts @@ -1,4 +1,4 @@ -import {StyleSheet, Platform} from 'react-native' +import {Platform, StyleSheet} from 'react-native' export const commonStyles = StyleSheet.create({ button: { diff --git a/modules/navigation-tabs/tabbar-icon.tsx b/modules/navigation-tabs/tabbar-icon.tsx index e16c19e103..f6faba0cc1 100644 --- a/modules/navigation-tabs/tabbar-icon.tsx +++ b/modules/navigation-tabs/tabbar-icon.tsx @@ -1,9 +1,10 @@ import * as React from 'react' import {StyleSheet} from 'react-native' -import {default as Ionicon} from 'react-native-vector-icons/Ionicons' -import {default as MaterialCommunityIcon} from 'react-native-vector-icons/MaterialCommunityIcons' + import type * as IoniconsGlyphs from 'react-native-vector-icons/glyphmaps/Ionicons.json' import type * as MaterialCommunityIconsGlyphs from 'react-native-vector-icons/glyphmaps/MaterialCommunityIcons.json' +import {default as Ionicon} from 'react-native-vector-icons/Ionicons' +import {default as MaterialCommunityIcon} from 'react-native-vector-icons/MaterialCommunityIcons' const styles = StyleSheet.create({ icon: { diff --git a/modules/navigation-tabs/tabbed-view.tsx b/modules/navigation-tabs/tabbed-view.tsx index f82e13b070..4a7aa760b4 100644 --- a/modules/navigation-tabs/tabbed-view.tsx +++ b/modules/navigation-tabs/tabbed-view.tsx @@ -1,8 +1,9 @@ import React from 'react' +import {Platform} from 'react-native' + import {createBottomTabNavigator as createCupertinoBottomTabNavigator} from '@react-navigation/bottom-tabs' import {createMaterialBottomTabNavigator} from '@react-navigation/material-bottom-tabs' import {ParamListBase} from '@react-navigation/native' -import {Platform} from 'react-native' export interface Tab { enabled?: true | false | undefined diff --git a/modules/notice/loading.tsx b/modules/notice/loading.tsx index a2201e2115..6f7d6c85a3 100644 --- a/modules/notice/loading.tsx +++ b/modules/notice/loading.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {NoticeView} from './notice' export function LoadingView({text = 'Loading…'}: {text?: string}): JSX.Element { diff --git a/modules/notice/notice.tsx b/modules/notice/notice.tsx index f3aeb4bb7b..0024b8fc1d 100644 --- a/modules/notice/notice.tsx +++ b/modules/notice/notice.tsx @@ -8,8 +8,9 @@ import { View, ViewStyle, } from 'react-native' -import * as c from '@frogpond/colors' + import {Button} from '@frogpond/button' +import * as c from '@frogpond/colors' import {Heading} from '@frogpond/markdown' const styles = StyleSheet.create({ diff --git a/modules/open-url/__tests__/open-url.test.ts b/modules/open-url/__tests__/open-url.test.ts index 381fbe047e..160b460a9b 100644 --- a/modules/open-url/__tests__/open-url.test.ts +++ b/modules/open-url/__tests__/open-url.test.ts @@ -1,6 +1,5 @@ -import {describe, expect, test} from '@jest/globals' - import {canOpenUrl} from '../open-url' +import {describe, expect, test} from '@jest/globals' describe('canOpenUrl', () => { test('opens http:// links', () => { diff --git a/modules/open-url/index.ts b/modules/open-url/index.ts index 273b98f609..e98f15c57a 100644 --- a/modules/open-url/index.ts +++ b/modules/open-url/index.ts @@ -1 +1 @@ -export {openUrl, trackedOpenUrl, canOpenUrl} from './open-url' +export {canOpenUrl, openUrl, trackedOpenUrl} from './open-url' diff --git a/modules/open-url/open-url.ts b/modules/open-url/open-url.ts index 5d97c10859..869b5ca191 100644 --- a/modules/open-url/open-url.ts +++ b/modules/open-url/open-url.ts @@ -1,5 +1,7 @@ import {Linking} from 'react-native' + import {InAppBrowser} from 'react-native-inappbrowser-reborn' + import * as storage from '../../source/lib/storage' function genericOpen(url: string): Promise { diff --git a/modules/separator/index.tsx b/modules/separator/index.tsx index 6e81f38abb..b28c4d3525 100644 --- a/modules/separator/index.tsx +++ b/modules/separator/index.tsx @@ -1,7 +1,8 @@ import * as React from 'react' -import {View, StyleSheet, Platform} from 'react-native' +import type {StyleProp, ViewStyle} from 'react-native' +import {Platform, StyleSheet, View} from 'react-native' + import * as c from '@frogpond/colors' -import type {ViewStyle, StyleProp} from 'react-native' const styles = StyleSheet.create({ separator: { diff --git a/modules/silly-card/index.tsx b/modules/silly-card/index.tsx index 416f7e3bb9..0327ddac11 100644 --- a/modules/silly-card/index.tsx +++ b/modules/silly-card/index.tsx @@ -1,13 +1,15 @@ import * as React from 'react' import { - View, - Text, - StyleSheet, Platform, StyleProp, + StyleSheet, + Text, + View, ViewStyle, } from 'react-native' -import {material, iOSUIKit} from 'react-native-typography' + +import {iOSUIKit, material} from 'react-native-typography' + import * as c from '@frogpond/colors' const cardStyles = StyleSheet.create({ diff --git a/modules/storage/__tests__/storage.test.ts b/modules/storage/__tests__/storage.test.ts index 474128b419..23082b4ec4 100644 --- a/modules/storage/__tests__/storage.test.ts +++ b/modules/storage/__tests__/storage.test.ts @@ -1,6 +1,5 @@ -import {describe, expect, test} from '@jest/globals' - import {getItemAsArray, getItemAsBoolean, getItemAsString} from '../index' +import {describe, expect, test} from '@jest/globals' describe('getItemAsBoolean', () => { test('returns fallback value', async () => { diff --git a/modules/tableview/cells/button.tsx b/modules/tableview/cells/button.tsx index 67e82876b4..a10d0b32cd 100644 --- a/modules/tableview/cells/button.tsx +++ b/modules/tableview/cells/button.tsx @@ -1,8 +1,9 @@ import * as React from 'react' import {StyleProp, StyleSheet, Text, TextStyle} from 'react-native' -import {Cell} from '@frogpond/tableview' + import * as c from '@frogpond/colors' import {Icon} from '@frogpond/icon' +import {Cell} from '@frogpond/tableview' const styles = StyleSheet.create({ title: { diff --git a/modules/tableview/cells/delete-button.tsx b/modules/tableview/cells/delete-button.tsx index 41f38f01a9..33d9c7cc4c 100644 --- a/modules/tableview/cells/delete-button.tsx +++ b/modules/tableview/cells/delete-button.tsx @@ -1,7 +1,9 @@ import * as React from 'react' -import {StyleSheet, Alert} from 'react-native' -import {Cell} from '@frogpond/tableview' +import {Alert, StyleSheet} from 'react-native' + import * as c from '@frogpond/colors' +import {Cell} from '@frogpond/tableview' + import noop from 'lodash/noop' const deleteStyles = StyleSheet.create({ diff --git a/modules/tableview/cells/index.ts b/modules/tableview/cells/index.ts index 061a0b3a83..6b5da0af78 100644 --- a/modules/tableview/cells/index.ts +++ b/modules/tableview/cells/index.ts @@ -1,7 +1,7 @@ -export {MultiLineDetailCell} from './multi-line-detail' -export {MultiLineLeftDetailCell} from './multi-line-left-detail' export {ButtonCell} from './button' export {DeleteButtonCell} from './delete-button' +export {MultiLineDetailCell} from './multi-line-detail' +export {MultiLineLeftDetailCell} from './multi-line-left-detail' export {PushButtonCell} from './push-button' export {SelectableCell} from './selectable' export {CellTextField} from './textfield' diff --git a/modules/tableview/cells/multi-line-detail.tsx b/modules/tableview/cells/multi-line-detail.tsx index 5d84690466..a5c8544061 100644 --- a/modules/tableview/cells/multi-line-detail.tsx +++ b/modules/tableview/cells/multi-line-detail.tsx @@ -1,7 +1,8 @@ import * as React from 'react' -import {Cell} from '@frogpond/tableview' import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' +import {Cell} from '@frogpond/tableview' type Props = { title: string diff --git a/modules/tableview/cells/multi-line-left-detail.tsx b/modules/tableview/cells/multi-line-left-detail.tsx index 52cd8e7b2a..44a86d63c1 100644 --- a/modules/tableview/cells/multi-line-left-detail.tsx +++ b/modules/tableview/cells/multi-line-left-detail.tsx @@ -1,7 +1,8 @@ import * as React from 'react' -import {Cell} from '@frogpond/tableview' import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' +import {Cell} from '@frogpond/tableview' type LeftDetailProps = { detail: string diff --git a/modules/tableview/cells/push-button.tsx b/modules/tableview/cells/push-button.tsx index 3e47d85f09..cafeddf584 100644 --- a/modules/tableview/cells/push-button.tsx +++ b/modules/tableview/cells/push-button.tsx @@ -1,6 +1,7 @@ import * as React from 'react' -import {Cell} from '@frogpond/tableview' + import * as c from '@frogpond/colors' +import {Cell} from '@frogpond/tableview' type Props = { title: string diff --git a/modules/tableview/cells/selectable.tsx b/modules/tableview/cells/selectable.tsx index 822eaf3a86..85317793fe 100644 --- a/modules/tableview/cells/selectable.tsx +++ b/modules/tableview/cells/selectable.tsx @@ -1,5 +1,6 @@ import * as React from 'react' -import {TextInput, StyleSheet} from 'react-native' +import {StyleSheet, TextInput} from 'react-native' + import * as c from '@frogpond/colors' const styles = StyleSheet.create({ diff --git a/modules/tableview/cells/textfield.tsx b/modules/tableview/cells/textfield.tsx index bc8d7c0fa7..e4556dfd2b 100644 --- a/modules/tableview/cells/textfield.tsx +++ b/modules/tableview/cells/textfield.tsx @@ -6,8 +6,9 @@ import { TextInput, TextInputProps, } from 'react-native' -import {Cell} from '@frogpond/tableview' + import * as c from '@frogpond/colors' +import {Cell} from '@frogpond/tableview' const styles = StyleSheet.create({ label: { diff --git a/modules/tableview/cells/toggle.tsx b/modules/tableview/cells/toggle.tsx index 256bbd0af7..22abda44ef 100644 --- a/modules/tableview/cells/toggle.tsx +++ b/modules/tableview/cells/toggle.tsx @@ -1,7 +1,8 @@ import * as React from 'react' import {Platform, Switch} from 'react-native' -import {Cell} from '@frogpond/tableview' + import {useTheme} from '@frogpond/app-theme' +import {Cell} from '@frogpond/tableview' type PropsType = { label: string diff --git a/modules/tableview/index.tsx b/modules/tableview/index.tsx index 41c701feac..3afbdc9eb2 100644 --- a/modules/tableview/index.tsx +++ b/modules/tableview/index.tsx @@ -1,12 +1,12 @@ import * as React from 'react' import {Platform, StyleSheet} from 'react-native' -import * as c from '@frogpond/colors' - import * as RNTableView from 'react-native-tableview-simple' +import {CellInterface} from 'react-native-tableview-simple/lib/typescript/components/Cell' import type {SectionInterface} from 'react-native-tableview-simple/lib/typescript/components/Section' import type {TableViewInterface} from 'react-native-tableview-simple/lib/typescript/components/TableView' -import {CellInterface} from 'react-native-tableview-simple/lib/typescript/components/Cell' + +import * as c from '@frogpond/colors' /* * Replacing onPress type with a less restricted type of our own @@ -52,4 +52,4 @@ const styles = StyleSheet.create({ }, }) -export {TableView, Section, Cell} +export {Cell, Section, TableView} diff --git a/modules/timer/index.ts b/modules/timer/index.ts index b689739382..4b8fb0d202 100644 --- a/modules/timer/index.ts +++ b/modules/timer/index.ts @@ -1,6 +1,7 @@ import {useState} from 'react' -import {default as moment, unitOfTime, type Moment} from 'moment-timezone' + import {useInterval} from './use-interval' +import {default as moment, type Moment, unitOfTime} from 'moment-timezone' interface BasicProps { intervalMs: number // ms diff --git a/modules/toolbar/toolbar-button.tsx b/modules/toolbar/toolbar-button.tsx index 5bfa1abfb8..5b019d755a 100644 --- a/modules/toolbar/toolbar-button.tsx +++ b/modules/toolbar/toolbar-button.tsx @@ -1,8 +1,9 @@ import * as React from 'react' -import {StyleSheet, View, Text} from 'react-native' -import {Icon} from '@frogpond/icon' -import type {Glyphs} from '@frogpond/icon' +import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' +import type {Glyphs} from '@frogpond/icon' +import {Icon} from '@frogpond/icon' const styles = StyleSheet.create({ button: { diff --git a/modules/toolbar/toolbar.tsx b/modules/toolbar/toolbar.tsx index 6fb9502550..ac23e2b82e 100644 --- a/modules/toolbar/toolbar.tsx +++ b/modules/toolbar/toolbar.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import {PropsWithChildren} from 'react' import {Platform, StyleSheet, View} from 'react-native' + import * as c from '@frogpond/colors' const toolbarStyles = StyleSheet.create({ diff --git a/modules/touchable/index.tsx b/modules/touchable/index.tsx index 240f1f7639..3a065a681e 100644 --- a/modules/touchable/index.tsx +++ b/modules/touchable/index.tsx @@ -9,6 +9,7 @@ import { View, ViewStyle, } from 'react-native' + import {white} from '@frogpond/colors' type Props = PropsWithChildren< diff --git a/modules/use-debounce/index.ts b/modules/use-debounce/index.ts index 2502d09874..92a6315f4d 100644 --- a/modules/use-debounce/index.ts +++ b/modules/use-debounce/index.ts @@ -1,4 +1,4 @@ -import {useState, useEffect} from 'react' +import {useEffect, useState} from 'react' export function useDebounce(value: T, delay: number): T { const [debouncedValue, setDebouncedValue] = useState(value) diff --git a/source/app.tsx b/source/app.tsx index f52fba3f26..943ab74bda 100644 --- a/source/app.tsx +++ b/source/app.tsx @@ -1,28 +1,29 @@ // TODO Check on https://github.com/kmagiera/react-native-gesture-handler/issues/320, // and remove this if/when it is no longer necessary -import 'react-native-gesture-handler' +import * as React from 'react' +import {StatusBar, useColorScheme} from 'react-native' +import {Provider as ReduxProvider} from 'react-redux' + +import {Provider as PaperProvider} from 'react-native-paper' + +import {NavigationContainer} from '@react-navigation/native' + +import {CombinedDarkTheme, CombinedLightTheme} from '@frogpond/app-theme' +import {LoadingView} from '@frogpond/notice' +import 'react-native-gesture-handler' // initialization import './init/constants' import './init/moment' -import * as sentryInit from './init/sentry' import './init/api' import './init/theme' -import {queryClient, persister} from './init/tanstack-query' - -import * as React from 'react' -import {PersistGate} from 'redux-persist/integration/react' -import {Provider as ReduxProvider} from 'react-redux' -import {Provider as PaperProvider} from 'react-native-paper' -import {PersistQueryClientProvider} from '@tanstack/react-query-persist-client' -import {store, persistor} from './redux' -import {CombinedLightTheme, CombinedDarkTheme} from '@frogpond/app-theme' -import {ActionSheetProvider} from '@expo/react-native-action-sheet' -import {NavigationContainer} from '@react-navigation/native' - +import * as sentryInit from './init/sentry' +import {persister, queryClient} from './init/tanstack-query' import {RootStack} from './navigation' -import {LoadingView} from '@frogpond/notice' -import {StatusBar, useColorScheme} from 'react-native' +import {persistor, store} from './redux' +import {ActionSheetProvider} from '@expo/react-native-action-sheet' +import {PersistQueryClientProvider} from '@tanstack/react-query-persist-client' +import {PersistGate} from 'redux-persist/integration/react' export default function App(): JSX.Element { // Create a ref for the navigation container diff --git a/source/components/__tests__/email.test.ts b/source/components/__tests__/email.test.ts index 18de86ebd9..8ec7e37e10 100644 --- a/source/components/__tests__/email.test.ts +++ b/source/components/__tests__/email.test.ts @@ -1,5 +1,5 @@ -import {describe, expect, it} from '@jest/globals' import {formatEmailParts} from '../send-email' +import {describe, expect, it} from '@jest/globals' describe('formatEmailParts', () => { it('should format empty inputs', () => { diff --git a/source/components/__tests__/phonenumber.test.ts b/source/components/__tests__/phonenumber.test.ts index 29455a0242..d04d6fc8b8 100644 --- a/source/components/__tests__/phonenumber.test.ts +++ b/source/components/__tests__/phonenumber.test.ts @@ -1,5 +1,5 @@ -import {describe, expect, it} from '@jest/globals' import {formatNumber} from '../call-phone' +import {describe, expect, it} from '@jest/globals' describe('formatNumber', () => { it('should return the same if not formattable', () => { diff --git a/source/components/call-phone.ts b/source/components/call-phone.ts index 7ca3f18fad..6df073e455 100644 --- a/source/components/call-phone.ts +++ b/source/components/call-phone.ts @@ -1,6 +1,8 @@ import {Alert} from 'react-native' -import Clipboard from '@react-native-clipboard/clipboard' + import {openUrl} from '@frogpond/open-url' + +import Clipboard from '@react-native-clipboard/clipboard' import {noop} from 'lodash' type Options = { diff --git a/source/components/send-email.ts b/source/components/send-email.ts index 26c8084578..79b1fd9184 100644 --- a/source/components/send-email.ts +++ b/source/components/send-email.ts @@ -1,7 +1,9 @@ import {Alert} from 'react-native' -import Clipboard from '@react-native-clipboard/clipboard' + import {openUrl} from '@frogpond/open-url' +import Clipboard from '@react-native-clipboard/clipboard' + type Args = { to?: Array cc?: Array diff --git a/source/init/api.ts b/source/init/api.ts index a6e238ca1b..42d2f22fdf 100644 --- a/source/init/api.ts +++ b/source/init/api.ts @@ -1,6 +1,7 @@ import {setApiRoot} from '@frogpond/api' -import * as storage from '../lib/storage' + import {DEFAULT_URL} from '../lib/constants' +import * as storage from '../lib/storage' const configureApiRoot = async () => { let address = await storage.getServerAddress() diff --git a/source/init/constants.ts b/source/init/constants.ts index 0644d4d461..4b79d0c024 100644 --- a/source/init/constants.ts +++ b/source/init/constants.ts @@ -1,10 +1,10 @@ -import {setVersionInfo, setAppName, setTimezone} from '@frogpond/constants' +import {setAppName, setTimezone, setVersionInfo} from '@frogpond/constants' + +import {name, version} from '../../package.json' export const SENTRY_DSN = 'https://7f68e814c5c24c32a582f2ddc3d42b4c@o524787.ingest.sentry.io/5637838' -import {version, name} from '../../package.json' - setVersionInfo(version) setAppName(name) setTimezone('America/Chicago') diff --git a/source/init/network.ts b/source/init/network.ts index adee4fa427..1724c8c7af 100644 --- a/source/init/network.ts +++ b/source/init/network.ts @@ -1,6 +1,7 @@ -import {isDevMode} from '@frogpond/constants' import {startNetworkLogging} from 'react-native-network-logger' +import {isDevMode} from '@frogpond/constants' + function initNetworkLogging() { if (!isDevMode()) { return diff --git a/source/init/sentry.ts b/source/init/sentry.ts index cd58cb6dae..ffe135e120 100644 --- a/source/init/sentry.ts +++ b/source/init/sentry.ts @@ -1,6 +1,7 @@ +import {IS_PRODUCTION} from '@frogpond/constants' + import {SENTRY_DSN} from './constants' import * as Sentry from '@sentry/react-native' -import {IS_PRODUCTION} from '@frogpond/constants' // Construct a new instrumentation instance. This is needed to communicate between the integration and React export const routingInstrumentation = diff --git a/source/init/tanstack-query.ts b/source/init/tanstack-query.ts index 80176c5fb2..bd63a3b7a5 100644 --- a/source/init/tanstack-query.ts +++ b/source/init/tanstack-query.ts @@ -1,8 +1,9 @@ import {AppState, Platform} from 'react-native' -import NetInfo from '@react-native-community/netinfo' + import AsyncStorage from '@react-native-async-storage/async-storage' +import NetInfo from '@react-native-community/netinfo' import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister' -import {QueryClient, onlineManager, focusManager} from '@tanstack/react-query' +import {focusManager, onlineManager, QueryClient} from '@tanstack/react-query' // // Set up caching diff --git a/source/lib/course-search/index.ts b/source/lib/course-search/index.ts index 1e0d19518e..30dfbeb980 100644 --- a/source/lib/course-search/index.ts +++ b/source/lib/course-search/index.ts @@ -1,2 +1,2 @@ -export type {CourseType, TermType} from './types' export {parseTerm} from './parse-term' +export type {CourseType, TermType} from './types' diff --git a/source/lib/course-search/urls.ts b/source/lib/course-search/urls.ts index 691352b428..5cef75fc15 100644 --- a/source/lib/course-search/urls.ts +++ b/source/lib/course-search/urls.ts @@ -1,5 +1,5 @@ -import ky, {Options} from 'ky' import {CourseType, RawCourseType, TermInfoType, TermType} from './types' +import ky, {Options} from 'ky' import intersection from 'lodash/intersection' const BASE_URL = 'https://stolaf.dev' diff --git a/source/lib/financials/balances.ts b/source/lib/financials/balances.ts index 26b8037613..fd1dd85418 100644 --- a/source/lib/financials/balances.ts +++ b/source/lib/financials/balances.ts @@ -1,8 +1,8 @@ -import ky from 'ky' -import {OLECARD_DATA_ENDPOINT} from './urls' -import type {BalancesShapeType, OleCardBalancesType} from './types' import {performLogin} from '../login' +import type {BalancesShapeType, OleCardBalancesType} from './types' +import {OLECARD_DATA_ENDPOINT} from './urls' import {useQuery, UseQueryResult} from '@tanstack/react-query' +import ky from 'ky' export const queryKeys = { default: (username: string | undefined) => ['balances', username] as const, diff --git a/source/lib/login.ts b/source/lib/login.ts index fffea21edf..06f05cd3bc 100644 --- a/source/lib/login.ts +++ b/source/lib/login.ts @@ -1,17 +1,18 @@ -import ky from 'ky' -import { - QueryObserverOptions, - useQuery, - UseQueryResult, -} from '@tanstack/react-query' import { getInternetCredentials, resetInternetCredentials, setInternetCredentials, SharedWebCredentials, } from 'react-native-keychain' -import {OLECARD_AUTH_URL} from './financials/urls' + import {queryClient} from '../init/tanstack-query' +import {OLECARD_AUTH_URL} from './financials/urls' +import { + QueryObserverOptions, + useQuery, + UseQueryResult, +} from '@tanstack/react-query' +import ky from 'ky' export class NoCredentialsError extends Error {} export class LoginFailedError extends Error {} diff --git a/source/lib/refresh.ts b/source/lib/refresh.ts index babba87aba..085938bd8b 100644 --- a/source/lib/refresh.ts +++ b/source/lib/refresh.ts @@ -1,8 +1,10 @@ -import {clearAsyncStorage} from './storage' +import {resetInternetCredentials} from 'react-native-keychain' import restart from 'react-native-restart' -import {SIS_LOGIN_KEY} from './login' + import * as icons from '@hawkrives/react-native-alternate-icons' -import {resetInternetCredentials} from 'react-native-keychain' + +import {SIS_LOGIN_KEY} from './login' +import {clearAsyncStorage} from './storage' export async function refreshApp(): Promise { // Clear AsyncStorage diff --git a/source/lib/stoprint/__mocks__/api.ts b/source/lib/stoprint/__mocks__/api.ts index 16380ad9cf..cbc74ed418 100644 --- a/source/lib/stoprint/__mocks__/api.ts +++ b/source/lib/stoprint/__mocks__/api.ts @@ -1,13 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* stoprint and papercut api mock data */ -import {mockAllPrinters} from './data/all-printers' -import {mockHeldJobs} from './data/held-jobs' -import {mockJobs} from './data/jobs' -import {mockRecent} from './data/recent' -import {mockRelease} from './data/release' - import {SharedWebCredentials} from 'react-native-keychain' + import type { AllPrintersResponse, HeldJobsResponse, @@ -15,6 +10,11 @@ import type { RecentPopularPrintersResponse, ReleaseResponse, } from '../types' +import {mockAllPrinters} from './data/all-printers' +import {mockHeldJobs} from './data/held-jobs' +import {mockJobs} from './data/jobs' +import {mockRecent} from './data/recent' +import {mockRelease} from './data/release' function papercut(mockData: T): Promise { return new Promise((resolve) => resolve(mockData)) diff --git a/source/lib/stoprint/api.ts b/source/lib/stoprint/api.ts index a6023b8d82..05163c7cf5 100644 --- a/source/lib/stoprint/api.ts +++ b/source/lib/stoprint/api.ts @@ -1,5 +1,9 @@ -import {mobileReleaseApi, papercutApi} from './urls' -import {encode} from 'base-64' +import {SharedWebCredentials} from 'react-native-keychain' + +import {client} from '@frogpond/api' + +import {isStoprintMocked} from '../../lib/stoprint' +import {LoginFailedError} from '../login' import { fetchAllPrinters as mockFetchAllPrinters, fetchJobs as mockFetchJobs, @@ -8,8 +12,6 @@ import { logIn as mockLogIn, releasePrintJobToPrinterForUser as mockReleasePrintJobToPrinterForUser, } from './__mocks__/api' -import {isStoprintMocked} from '../../lib/stoprint' - import type { AllPrintersResponse, CancelResponse, @@ -20,10 +22,9 @@ import type { RecentPopularPrintersResponse, ReleaseResponse, } from './types' +import {mobileReleaseApi, papercutApi} from './urls' +import {encode} from 'base-64' import {Options} from 'ky' -import {SharedWebCredentials} from 'react-native-keychain' -import {LoginFailedError} from '../login' -import {client} from '@frogpond/api' export class PapercutJobReleaseError extends Error {} diff --git a/source/lib/stoprint/index.ts b/source/lib/stoprint/index.ts index 379c02570a..e5d8e026ac 100644 --- a/source/lib/stoprint/index.ts +++ b/source/lib/stoprint/index.ts @@ -1,16 +1,16 @@ -export { - PAPERCUT, - PAPERCUT_API, - PAPERCUT_MOBILE_RELEASE_API, - STOPRINT_HELP_PAGE, -} from './urls' +export {isStoprintMocked} from './debug' +export {showGeneralError} from './errors' export type { + CancelResponse, HeldJob, + HeldJobsResponse, Printer, PrintJob, ReleaseResponse, - CancelResponse, - HeldJobsResponse, } from './types' -export {showGeneralError} from './errors' -export {isStoprintMocked} from './debug' +export { + PAPERCUT, + PAPERCUT_API, + PAPERCUT_MOBILE_RELEASE_API, + STOPRINT_HELP_PAGE, +} from './urls' diff --git a/source/lib/storage.ts b/source/lib/storage.ts index 55a4abceb3..bb0414dd47 100644 --- a/source/lib/storage.ts +++ b/source/lib/storage.ts @@ -6,6 +6,7 @@ import { setItem, setStoragePrefix, } from '@frogpond/storage' + import type {FilterComboType} from '../views/sis/course-search/lib/format-filter-combo' import type {CourseType, TermType} from './course-search/types' diff --git a/source/lib/theme.ts b/source/lib/theme.ts index dcc10174c7..13011539c7 100644 --- a/source/lib/theme.ts +++ b/source/lib/theme.ts @@ -1,8 +1,10 @@ import {Platform} from 'react-native' -import tinycolor from 'tinycolor2' -import {sto} from './colors' -import {firstReadable} from '@frogpond/colors' + import type {AppTheme} from '@frogpond/app-theme' +import {firstReadable} from '@frogpond/colors' + +import {sto} from './colors' +import tinycolor from 'tinycolor2' /** * The primary color of the app. diff --git a/source/navigation/index.ts b/source/navigation/index.ts index 9a373f127d..c16b89249d 100644 --- a/source/navigation/index.ts +++ b/source/navigation/index.ts @@ -1,2 +1,2 @@ -export {RootStack} from './routes' export {persistenceKey} from './constants' +export {RootStack} from './routes' diff --git a/source/navigation/routes.tsx b/source/navigation/routes.tsx index f60a82cc5c..1fff961f7c 100644 --- a/source/navigation/routes.tsx +++ b/source/navigation/routes.tsx @@ -1,42 +1,43 @@ import React from 'react' + import {createNativeStackNavigator} from '@react-navigation/native-stack' -import * as home from '../views/home' +import {EventDetail as eventDetail} from '@frogpond/event-list' +import { + DetailNavigationOptions, + MenuItemDetailView, +} from '@frogpond/food-menu/food-item-detail' +import {toLaxTitleCase} from '@frogpond/titlecase' + import * as buildingHours from '../views/building-hours' import * as calendar from '../views/calendar' -import {EventDetail as eventDetail} from '@frogpond/event-list' import * as contacts from '../views/contacts' import * as dictionary from '../views/dictionary' +import * as directory from '../views/directory' import * as faqs from '../views/faqs' -import * as sis from '../views/sis' -import * as studentwork from '../views/sis/student-work' -import * as studentworkdetail from '../views/sis/student-work/detail' +import * as home from '../views/home' import * as menus from '../views/menus' import * as carletonmenus from '../views/menus/carleton-menus' import { BonAppPickerView as DevBonAppPickerView, DevBonAppNavigationOptions, } from '../views/menus/dev-bonapp-picker' -import { - DetailNavigationOptions, - MenuItemDetailView, -} from '@frogpond/food-menu/food-item-detail' +import * as more from '../views/more' import * as news from '../views/news' import * as settings from '../views/settings/' +import {NavigationKey as Debug} from '../views/settings/screens/debug' +import * as sis from '../views/sis' +import * as studentwork from '../views/sis/student-work' +import * as studentworkdetail from '../views/sis/student-work/detail' +import * as stoprint from '../views/stoprint' import * as streaming from '../views/streaming' import * as orgs from '../views/student-orgs' import * as transportation from '../views/transportation' -import * as stoprint from '../views/stoprint' -import * as more from '../views/more' -import * as directory from '../views/directory' - import { + ComponentLibraryStackParamList, RootStackParamList, SettingsStackParamList, - ComponentLibraryStackParamList, } from './types' -import {NavigationKey as Debug} from '../views/settings/screens/debug' -import {toLaxTitleCase} from '@frogpond/titlecase' const Stack = createNativeStackNavigator() const SettingsStack = createNativeStackNavigator() diff --git a/source/navigation/types.tsx b/source/navigation/types.tsx index 628101b2c8..d54375b6de 100644 --- a/source/navigation/types.tsx +++ b/source/navigation/types.tsx @@ -1,32 +1,31 @@ import React from 'react' -import {FilterType} from '@frogpond/filter/types' import * as eventList from '@frogpond/event-list' +import {FilterType} from '@frogpond/filter/types' -import * as menus from '../views/menus' -import * as calendar from '../views/calendar' -import * as news from '../views/news' -import * as sis from '../views/sis' -import * as streaming from '../views/streaming' -import * as transportation from '../views/transportation' -import * as debug from '../views/settings/screens/debug' +import {CourseType} from '../lib/course-search/types' +import {Printer, PrintJob} from '../lib/stoprint/types' import * as buildingHours from '../views/building-hours' -import * as settings from '../views/settings' - +import {RouteParams as HoursEditorType} from '../views/building-hours/report/editor' import {BuildingType} from '../views/building-hours/types' +import * as calendar from '../views/calendar' import {ContactType} from '../views/contacts/types' -import {StudentOrgType} from '../views/student-orgs/types' -import {RouteParams as HoursEditorType} from '../views/building-hours/report/editor' import {WordType} from '../views/dictionary/types' -import {UnprocessedBusLine} from '../views/transportation/bus/types' +import {DirectoryItem, DirectorySearchTypeEnum} from '../views/directory/types' +import * as menus from '../views/menus' import type { MasterCorIconMapType, MenuItemType as MenuItem, } from '../views/menus/types' -import {Printer, PrintJob} from '../lib/stoprint/types' +import * as news from '../views/news' +import * as settings from '../views/settings' +import * as debug from '../views/settings/screens/debug' +import * as sis from '../views/sis' import {JobType} from '../views/sis/student-work/types' -import {CourseType} from '../lib/course-search/types' -import {DirectoryItem, DirectorySearchTypeEnum} from '../views/directory/types' +import * as streaming from '../views/streaming' +import {StudentOrgType} from '../views/student-orgs/types' +import * as transportation from '../views/transportation' +import {UnprocessedBusLine} from '../views/transportation/bus/types' export type RootViewsParamList = { Home: undefined diff --git a/source/redux/hooks.ts b/source/redux/hooks.ts index bdfcc180b7..e12d9b3f89 100644 --- a/source/redux/hooks.ts +++ b/source/redux/hooks.ts @@ -1,6 +1,7 @@ -import {useDispatch, useSelector} from 'react-redux' import type {TypedUseSelectorHook} from 'react-redux' -import type {RootState, AppDispatch} from './store' +import {useDispatch, useSelector} from 'react-redux' + +import type {AppDispatch, RootState} from './store' // Use throughout your app instead of plain `useDispatch` and `useSelector` export const useAppDispatch: () => AppDispatch = useDispatch diff --git a/source/redux/index.ts b/source/redux/index.ts index bdf3f418a7..0dc126bf06 100644 --- a/source/redux/index.ts +++ b/source/redux/index.ts @@ -1,5 +1,5 @@ export {useAppDispatch, useAppSelector} from './hooks' -export {type AppDispatch, type RootState, store, persistor} from './store' export {selectFavoriteBuildings} from './parts/buildings' -export {selectAcknowledgement} from './parts/settings' export {selectRecentFilters, selectRecentSearches} from './parts/courses' +export {selectAcknowledgement} from './parts/settings' +export {type AppDispatch, persistor, type RootState, store} from './store' diff --git a/source/redux/parts/buildings.ts b/source/redux/parts/buildings.ts index c437d5206c..8fbf5ff6d8 100644 --- a/source/redux/parts/buildings.ts +++ b/source/redux/parts/buildings.ts @@ -1,6 +1,6 @@ -import {createSlice} from '@reduxjs/toolkit' -import type {PayloadAction} from '@reduxjs/toolkit' import type {RootState} from '../store' +import type {PayloadAction} from '@reduxjs/toolkit' +import {createSlice} from '@reduxjs/toolkit' type State = { favorites: Array diff --git a/source/redux/parts/courses.ts b/source/redux/parts/courses.ts index bcc9d99e4c..cebfa9d9d5 100644 --- a/source/redux/parts/courses.ts +++ b/source/redux/parts/courses.ts @@ -1,13 +1,13 @@ import type {FilterType} from '@frogpond/filter' + +import {CourseType} from '../../lib/course-search' import { - formatFilterCombo, type FilterComboType, + formatFilterCombo, } from '../../views/sis/course-search/lib/format-filter-combo' - -import {createSlice} from '@reduxjs/toolkit' -import type {PayloadAction} from '@reduxjs/toolkit' import type {RootState} from '../store' -import {CourseType} from '../../lib/course-search' +import type {PayloadAction} from '@reduxjs/toolkit' +import {createSlice} from '@reduxjs/toolkit' type State = { recentFilters: FilterComboType[] diff --git a/source/redux/parts/settings.ts b/source/redux/parts/settings.ts index 9c56d93a04..c90d5fa40b 100644 --- a/source/redux/parts/settings.ts +++ b/source/redux/parts/settings.ts @@ -1,6 +1,6 @@ -import {createSlice} from '@reduxjs/toolkit' -import type {PayloadAction} from '@reduxjs/toolkit' import type {RootState} from '../store' +import type {PayloadAction} from '@reduxjs/toolkit' +import {createSlice} from '@reduxjs/toolkit' type State = { unofficialityAcknowledged: boolean diff --git a/source/redux/store.ts b/source/redux/store.ts index a98d2bedac..e76438d37b 100644 --- a/source/redux/store.ts +++ b/source/redux/store.ts @@ -1,20 +1,18 @@ -import {configureStore, combineReducers} from '@reduxjs/toolkit' - -import {reducer as settings} from './parts/settings' import {reducer as buildings} from './parts/buildings' import {reducer as courses} from './parts/courses' - +import {reducer as settings} from './parts/settings' +import AsyncStorage from '@react-native-async-storage/async-storage' +import {combineReducers, configureStore} from '@reduxjs/toolkit' import { - persistStore, - persistReducer, FLUSH, - REHYDRATE, PAUSE, PERSIST, + persistReducer, + persistStore, PURGE, REGISTER, + REHYDRATE, } from 'redux-persist' -import AsyncStorage from '@react-native-async-storage/async-storage' const persistConfig = { key: 'root', diff --git a/source/root.ts b/source/root.ts index 0e81a0f2b1..a05c68e1f6 100644 --- a/source/root.ts +++ b/source/root.ts @@ -1,6 +1,10 @@ // This declaration must be inside the app code, so that Typescript merges // it with the default react typings. If it is placed into a separate .d.ts // file, Typescript will instead replace the default typings. +import {AppRegistry} from 'react-native' + +import App from './app' + declare module 'react' { // source: https://fettblog.eu/typescript-react-generic-forward-refs/ function forwardRef( @@ -8,7 +12,4 @@ declare module 'react' { ): (props: P & React.RefAttributes) => React.ReactElement | null } -import {AppRegistry} from 'react-native' -import App from './app' - AppRegistry.registerComponent('AllAboutOlaf', () => App) diff --git a/source/views/building-hours/detail/building.tsx b/source/views/building-hours/detail/building.tsx index 1fb9a9c54b..0c5457712a 100644 --- a/source/views/building-hours/detail/building.tsx +++ b/source/views/building-hours/detail/building.tsx @@ -1,15 +1,16 @@ import * as React from 'react' -import {ScrollView, StyleSheet, Image} from 'react-native' -import {images as buildingImages} from '../../../../images/spaces' -import type {BuildingType} from '../types' -import type {Moment} from 'moment-timezone' -import {getShortBuildingStatus, hoursBackgroundColors} from '../lib' +import {Image, ScrollView, StyleSheet} from 'react-native' import {SolidBadge as Badge} from '@frogpond/badge' -import {Header} from './header' -import {ScheduleTable} from './schedule-table' import {ListFooter} from '@frogpond/lists' + +import {images as buildingImages} from '../../../../images/spaces' +import {getShortBuildingStatus, hoursBackgroundColors} from '../lib' +import type {BuildingType} from '../types' +import {Header} from './header' import {LinkTable} from './link-table' +import {ScheduleTable} from './schedule-table' +import type {Moment} from 'moment-timezone' const styles = StyleSheet.create({ image: { diff --git a/source/views/building-hours/detail/header.tsx b/source/views/building-hours/detail/header.tsx index 0b6cd12da3..fb185a9d20 100644 --- a/source/views/building-hours/detail/header.tsx +++ b/source/views/building-hours/detail/header.tsx @@ -4,10 +4,12 @@ */ import * as React from 'react' -import {View, Text, StyleSheet} from 'react-native' -import type {BuildingType} from '../types' +import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' +import type {BuildingType} from '../types' + type Props = {building: BuildingType} export const Header = (props: Props): JSX.Element => { diff --git a/source/views/building-hours/detail/index.tsx b/source/views/building-hours/detail/index.tsx index 6b7211f9ae..87c7f013e1 100644 --- a/source/views/building-hours/detail/index.tsx +++ b/source/views/building-hours/detail/index.tsx @@ -1,11 +1,14 @@ import * as React from 'react' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {timezone} from '@frogpond/constants' import {useMomentTimer} from '@frogpond/timer' + +import {RootStackParamList} from '../../../navigation/types' import {BuildingDetail} from './building' -import {timezone} from '@frogpond/constants' import {BuildingFavoriteButton} from './toolbar-button' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' -import {RootStackParamList} from '../../../navigation/types' export function BuildingHoursDetailView(): JSX.Element { let navigation = useNavigation() diff --git a/source/views/building-hours/detail/link-table-android.tsx b/source/views/building-hours/detail/link-table-android.tsx index 9b812a94b9..280137807c 100644 --- a/source/views/building-hours/detail/link-table-android.tsx +++ b/source/views/building-hours/detail/link-table-android.tsx @@ -4,9 +4,11 @@ import * as React from 'react' import {StyleSheet} from 'react-native' + +import {openUrl} from '@frogpond/open-url' import {Card} from '@frogpond/silly-card' import {ButtonCell} from '@frogpond/tableview/cells' -import {openUrl} from '@frogpond/open-url' + import type {BuildingLinkType} from '../types' type Props = { diff --git a/source/views/building-hours/detail/link-table-ios.tsx b/source/views/building-hours/detail/link-table-ios.tsx index 274533ee74..3d1708fdea 100644 --- a/source/views/building-hours/detail/link-table-ios.tsx +++ b/source/views/building-hours/detail/link-table-ios.tsx @@ -3,9 +3,11 @@ */ import * as React from 'react' -import {TableView, Section} from '@frogpond/tableview' -import {PushButtonCell} from '@frogpond/tableview/cells' + import {openUrl} from '@frogpond/open-url' +import {Section, TableView} from '@frogpond/tableview' +import {PushButtonCell} from '@frogpond/tableview/cells' + import type {BuildingLinkType} from '../types' type Props = { diff --git a/source/views/building-hours/detail/link-table.ts b/source/views/building-hours/detail/link-table.ts index d8f53b56f0..956b30622c 100644 --- a/source/views/building-hours/detail/link-table.ts +++ b/source/views/building-hours/detail/link-table.ts @@ -1,6 +1,6 @@ import {Platform} from 'react-native' -import {LinkTable as LinkTableIos} from './link-table-ios' import {LinkTable as LinkTableAndroid} from './link-table-android' +import {LinkTable as LinkTableIos} from './link-table-ios' export const LinkTable = Platform.OS === 'ios' ? LinkTableIos : LinkTableAndroid diff --git a/source/views/building-hours/detail/schedule-row-android.tsx b/source/views/building-hours/detail/schedule-row-android.tsx index 0b1ae26615..fb7ecc00bc 100644 --- a/source/views/building-hours/detail/schedule-row-android.tsx +++ b/source/views/building-hours/detail/schedule-row-android.tsx @@ -3,11 +3,11 @@ */ import * as React from 'react' -import {View, Text, StyleSheet, StyleProp, TextStyle} from 'react-native' -import type {Moment} from 'moment-timezone' -import type {SingleBuildingScheduleType} from '../types' +import {StyleProp, StyleSheet, Text, TextStyle, View} from 'react-native' import {formatBuildingTimes, summarizeDays} from '../lib' +import type {SingleBuildingScheduleType} from '../types' +import type {Moment} from 'moment-timezone' type Props = { set: SingleBuildingScheduleType diff --git a/source/views/building-hours/detail/schedule-row-ios.tsx b/source/views/building-hours/detail/schedule-row-ios.tsx index 2c0f9fc589..a9c236583f 100644 --- a/source/views/building-hours/detail/schedule-row-ios.tsx +++ b/source/views/building-hours/detail/schedule-row-ios.tsx @@ -4,10 +4,12 @@ import * as React from 'react' import {StyleSheet} from 'react-native' -import type {SingleBuildingScheduleType} from '../types' -import type {Moment} from 'moment-timezone' + import {Cell} from '@frogpond/tableview' + import {formatBuildingTimes, summarizeDays} from '../lib' +import type {SingleBuildingScheduleType} from '../types' +import type {Moment} from 'moment-timezone' type Props = { set: SingleBuildingScheduleType diff --git a/source/views/building-hours/detail/schedule-row.ts b/source/views/building-hours/detail/schedule-row.ts index be6b3789e2..fb5b32f372 100644 --- a/source/views/building-hours/detail/schedule-row.ts +++ b/source/views/building-hours/detail/schedule-row.ts @@ -1,7 +1,7 @@ import {Platform} from 'react-native' -import {ScheduleRow as ScheduleRowIos} from './schedule-row-ios' import {ScheduleRow as ScheduleRowAndroid} from './schedule-row-android' +import {ScheduleRow as ScheduleRowIos} from './schedule-row-ios' export const ScheduleRow = Platform.OS === 'ios' ? ScheduleRowIos : ScheduleRowAndroid diff --git a/source/views/building-hours/detail/schedule-table-android.tsx b/source/views/building-hours/detail/schedule-table-android.tsx index ce7a86cc03..155368961d 100644 --- a/source/views/building-hours/detail/schedule-table-android.tsx +++ b/source/views/building-hours/detail/schedule-table-android.tsx @@ -1,11 +1,13 @@ import * as React from 'react' -import {View, StyleSheet} from 'react-native' +import {StyleSheet, View} from 'react-native' + import {Card} from '@frogpond/silly-card' -import type {Moment} from 'moment-timezone' +import {ButtonCell} from '@frogpond/tableview/cells' + +import {getDayOfWeek, isScheduleOpenAtMoment} from '../lib' import type {NamedBuildingScheduleType} from '../types' -import {isScheduleOpenAtMoment, getDayOfWeek} from '../lib' import {ScheduleRow} from './schedule-row' -import {ButtonCell} from '@frogpond/tableview/cells' +import type {Moment} from 'moment-timezone' type Props = { now: Moment diff --git a/source/views/building-hours/detail/schedule-table-ios.tsx b/source/views/building-hours/detail/schedule-table-ios.tsx index 2d99ad5503..090737bfae 100644 --- a/source/views/building-hours/detail/schedule-table-ios.tsx +++ b/source/views/building-hours/detail/schedule-table-ios.tsx @@ -3,11 +3,13 @@ */ import * as React from 'react' -import {TableView, Section, Cell} from '@frogpond/tableview' -import type {Moment} from 'moment-timezone' + +import {Cell, Section, TableView} from '@frogpond/tableview' + +import {getDayOfWeek, isScheduleOpenAtMoment} from '../lib' import type {NamedBuildingScheduleType} from '../types' -import {isScheduleOpenAtMoment, getDayOfWeek} from '../lib' import {ScheduleRow} from './schedule-row' +import type {Moment} from 'moment-timezone' type Props = { now: Moment diff --git a/source/views/building-hours/detail/schedule-table.ts b/source/views/building-hours/detail/schedule-table.ts index b3db23329c..9d98db8751 100644 --- a/source/views/building-hours/detail/schedule-table.ts +++ b/source/views/building-hours/detail/schedule-table.ts @@ -1,7 +1,7 @@ import {Platform} from 'react-native' -import {ScheduleTable as ScheduleTableIos} from './schedule-table-ios' import {ScheduleTable as ScheduleTableAndroid} from './schedule-table-android' +import {ScheduleTable as ScheduleTableIos} from './schedule-table-ios' export const ScheduleTable = Platform.OS === 'ios' ? ScheduleTableIos : ScheduleTableAndroid diff --git a/source/views/building-hours/detail/toolbar-button.tsx b/source/views/building-hours/detail/toolbar-button.tsx index 9a0b91fb57..1262c9a5ca 100644 --- a/source/views/building-hours/detail/toolbar-button.tsx +++ b/source/views/building-hours/detail/toolbar-button.tsx @@ -1,10 +1,12 @@ import * as React from 'react' + import {FavoriteButton} from '@frogpond/navigation-buttons' + +import {useAppDispatch, useAppSelector} from '../../../redux' import { selectFavoriteBuildings, toggleFavoriteBuilding, } from '../../../redux/parts/buildings' -import {useAppDispatch, useAppSelector} from '../../../redux' type Props = { buildingName: string diff --git a/source/views/building-hours/index.ts b/source/views/building-hours/index.ts index 6e85789114..68fa587588 100644 --- a/source/views/building-hours/index.ts +++ b/source/views/building-hours/index.ts @@ -1,14 +1,12 @@ -export {BuildingHoursView, NavigationOptions} from './list' - export { BuildingHoursDetailView, NavigationOptions as DetailNavigationOptions, } from './detail' - +export {BuildingHoursView, NavigationOptions} from './list' export { BuildingHoursProblemReportView, BuildingHoursScheduleEditorView, - ReportNavigationOptions, EditorNavigationOptions, ReportNavigationKey, + ReportNavigationOptions, } from './report' diff --git a/source/views/building-hours/lib/__tests__/format-building-times.test.ts b/source/views/building-hours/lib/__tests__/format-building-times.test.ts index ae22adc510..a8272cdf04 100644 --- a/source/views/building-hours/lib/__tests__/format-building-times.test.ts +++ b/source/views/building-hours/lib/__tests__/format-building-times.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {SingleBuildingScheduleType} from '../../types' import {formatBuildingTimes} from '../format-times' import {dayMoment} from './moment.helper' -import {SingleBuildingScheduleType} from '../../types' +import {expect, it} from '@jest/globals' it('formats the times', () => { let m = dayMoment('Fri 3:00pm') diff --git a/source/views/building-hours/lib/__tests__/get-detailed-building-status.test.ts b/source/views/building-hours/lib/__tests__/get-detailed-building-status.test.ts index 5f20ba30e2..108405f653 100644 --- a/source/views/building-hours/lib/__tests__/get-detailed-building-status.test.ts +++ b/source/views/building-hours/lib/__tests__/get-detailed-building-status.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {BuildingType} from '../../types' import {getDetailedBuildingStatus} from '../get-detailed-status' import {plainMoment} from './moment.helper' -import {BuildingType} from '../../types' +import {expect, it} from '@jest/globals' it('returns a list of [isOpen, scheduleName, verboseStatus] tuples', () => { let m = plainMoment('06-23-2018 1:00pm', 'MM-DD-YYYY h:mma') diff --git a/source/views/building-hours/lib/__tests__/get-schedule-status.test.ts b/source/views/building-hours/lib/__tests__/get-schedule-status.test.ts index cd0304f9f1..3019688f1f 100644 --- a/source/views/building-hours/lib/__tests__/get-schedule-status.test.ts +++ b/source/views/building-hours/lib/__tests__/get-schedule-status.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {SingleBuildingScheduleType} from '../../types' import {getScheduleStatusAtMoment} from '../get-schedule-status' import {dayMoment} from './moment.helper' -import {SingleBuildingScheduleType} from '../../types' +import {expect, it} from '@jest/globals' it('handles if a schedule is open', () => { let m = dayMoment('Fri 3:00pm') diff --git a/source/views/building-hours/lib/__tests__/get-short-building-status.test.ts b/source/views/building-hours/lib/__tests__/get-short-building-status.test.ts index 42d6ba1e1e..1f01e21e7b 100644 --- a/source/views/building-hours/lib/__tests__/get-short-building-status.test.ts +++ b/source/views/building-hours/lib/__tests__/get-short-building-status.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {BuildingType} from '../../types' import {getShortBuildingStatus} from '../get-short-status' import {dayMoment} from './moment.helper' -import {BuildingType} from '../../types' +import {expect, it} from '@jest/globals' it('checks a list of schedules to see if any are open', () => { let m = dayMoment('Fri 1:00pm') diff --git a/source/views/building-hours/lib/__tests__/is-building-open.test.ts b/source/views/building-hours/lib/__tests__/is-building-open.test.ts index c4f7321608..68260d1a0d 100644 --- a/source/views/building-hours/lib/__tests__/is-building-open.test.ts +++ b/source/views/building-hours/lib/__tests__/is-building-open.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {BuildingType} from '../../types' import {isBuildingOpen} from '../is-building-open' import {dayMoment} from './moment.helper' -import {BuildingType} from '../../types' +import {expect, it} from '@jest/globals' it('checks a list of schedules to see if any are open', () => { let m = dayMoment('Fri 1:00pm') diff --git a/source/views/building-hours/lib/__tests__/is-chapel-time.test.ts b/source/views/building-hours/lib/__tests__/is-chapel-time.test.ts index 2db5776ff7..f6ae6705c7 100644 --- a/source/views/building-hours/lib/__tests__/is-chapel-time.test.ts +++ b/source/views/building-hours/lib/__tests__/is-chapel-time.test.ts @@ -1,6 +1,6 @@ -import {expect, it} from '@jest/globals' import {isChapelTime} from '../chapel' import {dayMoment} from './moment.helper' +import {expect, it} from '@jest/globals' it('checks if a moment is during chapel time', () => { let m = isChapelTime(dayMoment('Mon 10:10am')) diff --git a/source/views/building-hours/lib/__tests__/is-schedule-open-at-moment.test.ts b/source/views/building-hours/lib/__tests__/is-schedule-open-at-moment.test.ts index b55df217e8..deaa8c7230 100644 --- a/source/views/building-hours/lib/__tests__/is-schedule-open-at-moment.test.ts +++ b/source/views/building-hours/lib/__tests__/is-schedule-open-at-moment.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {SingleBuildingScheduleType} from '../../types' import {isScheduleOpenAtMoment} from '../is-schedule-open' import {dayMoment} from './moment.helper' -import {SingleBuildingScheduleType} from '../../types' +import {expect, it} from '@jest/globals' it('checks if a schedule is open at the provided moment', () => { let m = dayMoment('Fri 3:00pm') diff --git a/source/views/building-hours/lib/__tests__/parse-hours.test.ts b/source/views/building-hours/lib/__tests__/parse-hours.test.ts index d53db04be0..30fa4f844a 100644 --- a/source/views/building-hours/lib/__tests__/parse-hours.test.ts +++ b/source/views/building-hours/lib/__tests__/parse-hours.test.ts @@ -1,7 +1,7 @@ -import {expect, it} from '@jest/globals' +import {SingleBuildingScheduleType} from '../../types' import {parseHours} from '../parse-hours' import {dayMoment, hourMoment, moment, plainMoment} from './moment.helper' -import {SingleBuildingScheduleType} from '../../types' +import {expect, it} from '@jest/globals' it('returns an {open, close} tuple', () => { let now = hourMoment('10:01am') diff --git a/source/views/building-hours/lib/__tests__/summarize-days.test.ts b/source/views/building-hours/lib/__tests__/summarize-days.test.ts index cbdfa85ee6..9266530a1e 100644 --- a/source/views/building-hours/lib/__tests__/summarize-days.test.ts +++ b/source/views/building-hours/lib/__tests__/summarize-days.test.ts @@ -1,6 +1,6 @@ -import {describe, expect, test} from '@jest/globals' -import {summarizeDays, summarizeDaysAndHours} from '../summarize-days' import {DayOfWeekEnumType} from '../../types' +import {summarizeDays, summarizeDaysAndHours} from '../summarize-days' +import {describe, expect, test} from '@jest/globals' describe('returns a single day if only a single day is given', () => { let allDays: [DayOfWeekEnumType, string][] = [ diff --git a/source/views/building-hours/lib/chapel.ts b/source/views/building-hours/lib/chapel.ts index 41a346e211..5485598599 100644 --- a/source/views/building-hours/lib/chapel.ts +++ b/source/views/building-hours/lib/chapel.ts @@ -1,10 +1,9 @@ -import type {Moment} from 'moment-timezone' import type {SingleBuildingScheduleType} from '../types' - +import {formatBuildingTimes} from './format-times' import {getDayOfWeek} from './get-day-of-week' import {isScheduleReallyOpenAtMoment} from './is-schedule-really-open' -import {formatBuildingTimes} from './format-times' import {parseHours} from './parse-hours' +import type {Moment} from 'moment-timezone' // TODO: fetch this over the network const chapelSchedule: SingleBuildingScheduleType[] = [ diff --git a/source/views/building-hours/lib/color-helpers.ts b/source/views/building-hours/lib/color-helpers.ts index 8bd0095211..026d87533e 100644 --- a/source/views/building-hours/lib/color-helpers.ts +++ b/source/views/building-hours/lib/color-helpers.ts @@ -1,6 +1,7 @@ -import * as c from '@frogpond/colors' import {ColorValue} from 'react-native' +import * as c from '@frogpond/colors' + export const BG_COLORS: Record = { Open: c.systemGreen, Closed: c.systemRed, diff --git a/source/views/building-hours/lib/format-times.ts b/source/views/building-hours/lib/format-times.ts index c13d345e77..e3ada7f005 100644 --- a/source/views/building-hours/lib/format-times.ts +++ b/source/views/building-hours/lib/format-times.ts @@ -1,8 +1,7 @@ -import type {Moment} from 'moment-timezone' import type {SingleBuildingScheduleType} from '../types' - import {RESULT_FORMAT} from './constants' import {parseHours} from './parse-hours' +import type {Moment} from 'moment-timezone' function formatSingleTime(time: Moment): string { if (time.hour() === 0 && time.minute() === 0) { diff --git a/source/views/building-hours/lib/get-day-of-week.ts b/source/views/building-hours/lib/get-day-of-week.ts index f42e9eac32..2febaeee3f 100644 --- a/source/views/building-hours/lib/get-day-of-week.ts +++ b/source/views/building-hours/lib/get-day-of-week.ts @@ -1,5 +1,5 @@ -import type {Moment} from 'moment-timezone' import type {DayOfWeekEnumType} from '../types' +import type {Moment} from 'moment-timezone' export const getDayOfWeek = (m: Moment): DayOfWeekEnumType => m.format('dd') as DayOfWeekEnumType diff --git a/source/views/building-hours/lib/get-detailed-status.ts b/source/views/building-hours/lib/get-detailed-status.ts index 45e9f8d2f4..2a359b2303 100644 --- a/source/views/building-hours/lib/get-detailed-status.ts +++ b/source/views/building-hours/lib/get-detailed-status.ts @@ -1,11 +1,10 @@ -import type {Moment} from 'moment-timezone' -import flatten from 'lodash/flatten' import type {BuildingType} from '../types' - +import {formatChapelTime, isChapelTime} from './chapel' +import {formatBuildingTimes} from './format-times' import {getDayOfWeek} from './get-day-of-week' -import {isChapelTime, formatChapelTime} from './chapel' import {isScheduleOpenAtMoment} from './is-schedule-open' -import {formatBuildingTimes} from './format-times' +import flatten from 'lodash/flatten' +import type {Moment} from 'moment-timezone' export type BuildingStatus = { isActive: boolean diff --git a/source/views/building-hours/lib/get-schedule-status.ts b/source/views/building-hours/lib/get-schedule-status.ts index 2012791de4..5482b8c53e 100644 --- a/source/views/building-hours/lib/get-schedule-status.ts +++ b/source/views/building-hours/lib/get-schedule-status.ts @@ -1,7 +1,6 @@ -import type {Moment} from 'moment-timezone' import type {SingleBuildingScheduleType} from '../types' - import {parseHours} from './parse-hours' +import type {Moment} from 'moment-timezone' function in30(start: Moment, end: Moment) { return start.clone().add(30, 'minutes').isSameOrAfter(end) diff --git a/source/views/building-hours/lib/get-short-status.ts b/source/views/building-hours/lib/get-short-status.ts index c1a94cc726..04f632b63b 100644 --- a/source/views/building-hours/lib/get-short-status.ts +++ b/source/views/building-hours/lib/get-short-status.ts @@ -1,9 +1,8 @@ -import type {Moment} from 'moment-timezone' import type {BuildingType} from '../types' - import {isChapelTime} from './chapel' import {getDayOfWeek} from './get-day-of-week' import {getScheduleStatusAtMoment} from './get-schedule-status' +import type {Moment} from 'moment-timezone' export function getShortBuildingStatus(info: BuildingType, m: Moment): string { let dayOfWeek = getDayOfWeek(m) diff --git a/source/views/building-hours/lib/index.ts b/source/views/building-hours/lib/index.ts index 4d7f412b66..acab716882 100644 --- a/source/views/building-hours/lib/index.ts +++ b/source/views/building-hours/lib/index.ts @@ -1,14 +1,14 @@ -export {getDetailedBuildingStatus} from './get-detailed-status' -export {getShortBuildingStatus} from './get-short-status' -export {formatBuildingTimes} from './format-times' -export {summarizeDays, summarizeDaysAndHours} from './summarize-days' -export {isScheduleOpenAtMoment} from './is-schedule-open' -export {getDayOfWeek} from './get-day-of-week' -export {parseHours} from './parse-hours' export {blankSchedule} from './blank-schedule' export { - BG_COLORS as hoursBackgroundColors, - FG_COLORS as hoursForegroundColors, getAccentBackgroundColor, getAccentTextColor, + BG_COLORS as hoursBackgroundColors, + FG_COLORS as hoursForegroundColors, } from './color-helpers' +export {formatBuildingTimes} from './format-times' +export {getDayOfWeek} from './get-day-of-week' +export {getDetailedBuildingStatus} from './get-detailed-status' +export {getShortBuildingStatus} from './get-short-status' +export {isScheduleOpenAtMoment} from './is-schedule-open' +export {parseHours} from './parse-hours' +export {summarizeDays, summarizeDaysAndHours} from './summarize-days' diff --git a/source/views/building-hours/lib/is-building-open.ts b/source/views/building-hours/lib/is-building-open.ts index 84b8473bf7..8b1ae6d684 100644 --- a/source/views/building-hours/lib/is-building-open.ts +++ b/source/views/building-hours/lib/is-building-open.ts @@ -1,10 +1,9 @@ -import type {Moment} from 'moment-timezone' -import flatten from 'lodash/flatten' import type {BuildingType} from '../types' - -import {getDayOfWeek} from './get-day-of-week' import {isChapelTime} from './chapel' +import {getDayOfWeek} from './get-day-of-week' import {isScheduleOpenAtMoment} from './is-schedule-open' +import flatten from 'lodash/flatten' +import type {Moment} from 'moment-timezone' export function isBuildingOpen(info: BuildingType, m: Moment): boolean { let dayOfWeek = getDayOfWeek(m) diff --git a/source/views/building-hours/lib/is-schedule-open.ts b/source/views/building-hours/lib/is-schedule-open.ts index bf88e0919c..1501369d97 100644 --- a/source/views/building-hours/lib/is-schedule-open.ts +++ b/source/views/building-hours/lib/is-schedule-open.ts @@ -1,8 +1,7 @@ -import type {Moment} from 'moment-timezone' import type {SingleBuildingScheduleType} from '../types' - import {isChapelTime} from './chapel' import {isScheduleReallyOpenAtMoment} from './is-schedule-really-open' +import type {Moment} from 'moment-timezone' export function isScheduleOpenAtMoment( schedule: SingleBuildingScheduleType, diff --git a/source/views/building-hours/lib/is-schedule-really-open.ts b/source/views/building-hours/lib/is-schedule-really-open.ts index 4fa279afc3..1369c0c605 100644 --- a/source/views/building-hours/lib/is-schedule-really-open.ts +++ b/source/views/building-hours/lib/is-schedule-really-open.ts @@ -1,7 +1,6 @@ -import type {Moment} from 'moment-timezone' import type {SingleBuildingScheduleType} from '../types' - import {parseHours} from './parse-hours' +import type {Moment} from 'moment-timezone' export function isScheduleReallyOpenAtMoment( schedule: SingleBuildingScheduleType, diff --git a/source/views/building-hours/lib/parse-hours.ts b/source/views/building-hours/lib/parse-hours.ts index e3ca32cf2d..ffa6875269 100644 --- a/source/views/building-hours/lib/parse-hours.ts +++ b/source/views/building-hours/lib/parse-hours.ts @@ -1,9 +1,9 @@ -import moment from 'moment-timezone' -import type {Moment} from 'moment-timezone' -import type {SingleBuildingScheduleType} from '../types' import {timezone} from '@frogpond/constants' +import type {SingleBuildingScheduleType} from '../types' import {TIME_FORMAT} from './constants' +import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' type HourPairType = {open: Moment; close: Moment} diff --git a/source/views/building-hours/lib/summarize-days.ts b/source/views/building-hours/lib/summarize-days.ts index 9886b60757..342932362c 100644 --- a/source/views/building-hours/lib/summarize-days.ts +++ b/source/views/building-hours/lib/summarize-days.ts @@ -1,9 +1,8 @@ -import moment from 'moment-timezone' -import sortBy from 'lodash/sortBy' +import {formatDay} from '../../sis/course-search/lib/format-day' import type {DayOfWeekEnumType, SingleBuildingScheduleType} from '../types' - import {daysOfTheWeek} from './constants' -import {formatDay} from '../../sis/course-search/lib/format-day' +import sortBy from 'lodash/sortBy' +import moment from 'moment-timezone' export function summarizeDays( days: DayOfWeekEnumType[], diff --git a/source/views/building-hours/list.tsx b/source/views/building-hours/list.tsx index d53ab42e73..02c3d7f40b 100644 --- a/source/views/building-hours/list.tsx +++ b/source/views/building-hours/list.tsx @@ -1,15 +1,17 @@ import * as React from 'react' -import {StyleSheet, SectionList} from 'react-native' -import {BuildingRow} from './row' -import {useGroupedBuildings} from './query' -import {BuildingType} from './types' +import {SectionList, StyleSheet} from 'react-native' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' import * as c from '@frogpond/colors' -import {ListSeparator, ListSectionHeader} from '@frogpond/lists' +import {ListSectionHeader, ListSeparator} from '@frogpond/lists' import {LoadingView, NoticeView} from '@frogpond/notice' -import {useNavigation} from '@react-navigation/native' import {useMomentTimer} from '@frogpond/timer' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {useGroupedBuildings} from './query' +import {BuildingRow} from './row' +import {BuildingType} from './types' export {BuildingHoursDetailView} from './detail' diff --git a/source/views/building-hours/query.ts b/source/views/building-hours/query.ts index aed8e06d6b..345aff45e5 100644 --- a/source/views/building-hours/query.ts +++ b/source/views/building-hours/query.ts @@ -1,8 +1,9 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' -import {groupBy} from 'lodash' + import {selectFavoriteBuildings, useAppSelector} from '../../redux' import {BuildingType} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' +import {groupBy} from 'lodash' export const keys = { all: ['buildings'] as const, diff --git a/source/views/building-hours/report/editor.tsx b/source/views/building-hours/report/editor.tsx index 6dd110f3bf..a6aaebdb91 100644 --- a/source/views/building-hours/report/editor.tsx +++ b/source/views/building-hours/report/editor.tsx @@ -4,22 +4,25 @@ import * as React from 'react' import {useCallback, useState} from 'react' -import xor from 'lodash/xor' import {Platform, ScrollView, StyleSheet, Text} from 'react-native' -import type {Moment} from 'moment-timezone' -import moment from 'moment-timezone' -import {Cell, Section, TableView} from '@frogpond/tableview' -import {DeleteButtonCell} from '@frogpond/tableview/cells' -import type {DayOfWeekEnumType, SingleBuildingScheduleType} from '../types' -import {Row} from '@frogpond/layout' -import {blankSchedule, parseHours, summarizeDaysAndHours} from '../lib' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' import {DatePicker} from '@frogpond/datepicker' -import {Touchable} from '@frogpond/touchable' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import {Row} from '@frogpond/layout' import {CloseScreenButton} from '@frogpond/navigation-buttons' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {Cell, Section, TableView} from '@frogpond/tableview' +import {DeleteButtonCell} from '@frogpond/tableview/cells' +import {Touchable} from '@frogpond/touchable' + import {RootStackParamList} from '../../../navigation/types' +import {blankSchedule, parseHours, summarizeDaysAndHours} from '../lib' +import type {DayOfWeekEnumType, SingleBuildingScheduleType} from '../types' +import xor from 'lodash/xor' +import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' export type RouteParams = { set: SingleBuildingScheduleType | undefined diff --git a/source/views/building-hours/report/index.ts b/source/views/building-hours/report/index.ts index 0a71d1c308..abd12af6b4 100644 --- a/source/views/building-hours/report/index.ts +++ b/source/views/building-hours/report/index.ts @@ -4,6 +4,6 @@ export { } from './editor' export { BuildingHoursProblemReportView, - NavigationOptions as ReportNavigationOptions, NavigationKey as ReportNavigationKey, + NavigationOptions as ReportNavigationOptions, } from './overview' diff --git a/source/views/building-hours/report/overview.tsx b/source/views/building-hours/report/overview.tsx index fc5a9e3034..e94bbb8ad8 100644 --- a/source/views/building-hours/report/overview.tsx +++ b/source/views/building-hours/report/overview.tsx @@ -3,30 +3,33 @@ */ import * as React from 'react' -import {Alert, ScrollView, Platform, View} from 'react-native' -import moment from 'moment-timezone' -import type {Moment} from 'moment-timezone' -import noop from 'lodash/noop' -import jsYaml from 'js-yaml' +import {Alert, Platform, ScrollView, View} from 'react-native' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {InfoHeader} from '@frogpond/info-header' -import {TableView, Section, Cell} from '@frogpond/tableview' +import {CloseScreenButton} from '@frogpond/navigation-buttons' +import {Cell, Section, TableView} from '@frogpond/tableview' import { + ButtonCell, CellTextField, CellToggle, DeleteButtonCell, - ButtonCell, } from '@frogpond/tableview/cells' + +import {RootStackParamList} from '../../../navigation/types' +import {blankSchedule, formatBuildingTimes, summarizeDays} from '../lib' import type { BuildingType, NamedBuildingScheduleType, SingleBuildingScheduleType, } from '../types' -import {summarizeDays, formatBuildingTimes, blankSchedule} from '../lib' import {submitReport} from './submit' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' -import {CloseScreenButton} from '@frogpond/navigation-buttons' -import {RootStackParamList} from '../../../navigation/types' +import jsYaml from 'js-yaml' +import noop from 'lodash/noop' +import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' export let BuildingHoursProblemReportView = (): JSX.Element => { let navigation = useNavigation() diff --git a/source/views/building-hours/report/submit.ts b/source/views/building-hours/report/submit.ts index 4340f65c35..7b25db3961 100644 --- a/source/views/building-hours/report/submit.ts +++ b/source/views/building-hours/report/submit.ts @@ -1,7 +1,7 @@ -import jsYaml from 'js-yaml' -import type {BuildingType} from '../types' import {sendEmail} from '../../../components/send-email' import {GH_NEW_ISSUE_URL, SUPPORT_EMAIL} from '../../../lib/constants' +import type {BuildingType} from '../types' +import jsYaml from 'js-yaml' export function submitReport( current: BuildingType, diff --git a/source/views/building-hours/row.tsx b/source/views/building-hours/row.tsx index 9e32c13ae3..3a549cfcee 100644 --- a/source/views/building-hours/row.tsx +++ b/source/views/building-hours/row.tsx @@ -1,16 +1,18 @@ import * as React from 'react' -import {View, Text, StyleSheet} from 'react-native' +import {StyleSheet, Text, View} from 'react-native' + import {OutlineBadge as Badge} from '@frogpond/badge' -import type {Moment} from 'moment' -import type {BuildingType} from './types' import * as c from '@frogpond/colors' import {Row} from '@frogpond/layout' -import {ListRow, Detail, Title} from '@frogpond/lists' +import {Detail, ListRow, Title} from '@frogpond/lists' + import { + getAccentBackgroundColor, getDetailedBuildingStatus, getShortBuildingStatus, - getAccentBackgroundColor, } from './lib' +import type {BuildingType} from './types' +import type {Moment} from 'moment' const styles = StyleSheet.create({ title: { diff --git a/source/views/calendar/index.tsx b/source/views/calendar/index.tsx index c270d909e3..12156b9464 100644 --- a/source/views/calendar/index.tsx +++ b/source/views/calendar/index.tsx @@ -1,15 +1,16 @@ import * as React from 'react' import {Platform} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {CccCalendarView, useNamedCalendar} from '@frogpond/ccc-calendar' import { - MaterialIcon, - IosIcon, createTabNavigator, + IosIcon, + MaterialIcon, type Tab, } from '@frogpond/navigation-tabs' -import {CccCalendarView, useNamedCalendar} from '@frogpond/ccc-calendar' - function StOlafCalendarView() { return ( void diff --git a/source/views/dictionary/detail.tsx b/source/views/dictionary/detail.tsx index 5fa6e1c86a..42bc540fd9 100644 --- a/source/views/dictionary/detail.tsx +++ b/source/views/dictionary/detail.tsx @@ -1,12 +1,14 @@ import * as React from 'react' -import {StyleSheet, TextProps, Text, View, ViewProps} from 'react-native' -import {Markdown} from '@frogpond/markdown' -import {ListFooter} from '@frogpond/lists' +import {StyleSheet, Text, TextProps, View, ViewProps} from 'react-native' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {Button} from '@frogpond/button' import * as c from '@frogpond/colors' +import {ListFooter} from '@frogpond/lists' +import {Markdown} from '@frogpond/markdown' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' import {RootStackParamList} from '../../navigation/types' const styles = StyleSheet.create({ diff --git a/source/views/dictionary/index.ts b/source/views/dictionary/index.ts index 5bf1ed20c4..792dee4df5 100644 --- a/source/views/dictionary/index.ts +++ b/source/views/dictionary/index.ts @@ -1,3 +1,3 @@ +export {DetailNavigationOptions, DictionaryDetailView} from './detail' export {View as DictionaryView, NavigationOptions} from './list' -export {DictionaryDetailView, DetailNavigationOptions} from './detail' export {DictionaryEditorView, EditorNavigationOptions} from './report' diff --git a/source/views/dictionary/list.tsx b/source/views/dictionary/list.tsx index dc98d4bc1b..d5e79b7987 100644 --- a/source/views/dictionary/list.tsx +++ b/source/views/dictionary/list.tsx @@ -1,9 +1,10 @@ import * as React from 'react' import {SectionList, StyleSheet} from 'react-native' -import {ChangeTextEvent} from '../../navigation/types' -import {useDictionary} from './query' -import type {WordType, DictionaryGroup} from './types' +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' import { Detail, largeListProps, @@ -14,11 +15,10 @@ import { } from '@frogpond/lists' import {LoadingView, NoticeView} from '@frogpond/notice' import {useDebounce} from '@frogpond/use-debounce' -import * as c from '@frogpond/colors' - -import {useNavigation} from '@react-navigation/native' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import {ChangeTextEvent} from '../../navigation/types' +import {useDictionary} from './query' +import type {DictionaryGroup, WordType} from './types' import deburr from 'lodash/deburr' import groupBy from 'lodash/groupBy' import words from 'lodash/words' diff --git a/source/views/dictionary/query.ts b/source/views/dictionary/query.ts index 1a35f344c6..d75629568e 100644 --- a/source/views/dictionary/query.ts +++ b/source/views/dictionary/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' + import {WordType} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { all: ['dictionary'] as const, diff --git a/source/views/dictionary/report/__tests__/stringify-entry.test.ts b/source/views/dictionary/report/__tests__/stringify-entry.test.ts index 01ab80707d..ad38d952ac 100644 --- a/source/views/dictionary/report/__tests__/stringify-entry.test.ts +++ b/source/views/dictionary/report/__tests__/stringify-entry.test.ts @@ -1,5 +1,5 @@ -import {expect, test} from '@jest/globals' import {stringifyDictionaryEntry} from '../submit' +import {expect, test} from '@jest/globals' test('handles a basic term', () => { expect( diff --git a/source/views/dictionary/report/editor.tsx b/source/views/dictionary/report/editor.tsx index 882f0d4376..97f5fdfecf 100644 --- a/source/views/dictionary/report/editor.tsx +++ b/source/views/dictionary/report/editor.tsx @@ -1,12 +1,15 @@ import * as React from 'react' import {ScrollView} from 'react-native' -import {InfoHeader} from '@frogpond/info-header' -import {TableView, Section} from '@frogpond/tableview' -import {CellTextField, ButtonCell} from '@frogpond/tableview/cells' -import {submitReport} from './submit' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {InfoHeader} from '@frogpond/info-header' +import {Section, TableView} from '@frogpond/tableview' +import {ButtonCell, CellTextField} from '@frogpond/tableview/cells' + import {RootStackParamList} from '../../../navigation/types' +import {submitReport} from './submit' import noop from 'lodash/noop' export const NavigationOptions: NativeStackNavigationOptions = { diff --git a/source/views/dictionary/report/submit.ts b/source/views/dictionary/report/submit.ts index af2ffdb162..a6f5e96329 100644 --- a/source/views/dictionary/report/submit.ts +++ b/source/views/dictionary/report/submit.ts @@ -1,7 +1,7 @@ -import jsYaml from 'js-yaml' -import type {WordType} from '../types' import {sendEmail} from '../../../components/send-email' import {GH_NEW_ISSUE_URL, SUPPORT_EMAIL} from '../../../lib/constants' +import type {WordType} from '../types' +import jsYaml from 'js-yaml' import wrap from 'wordwrap' export function submitReport(current: WordType, suggestion: WordType): void { diff --git a/source/views/directory/detail.android.tsx b/source/views/directory/detail.android.tsx index b0d701a247..b2f99a6e47 100644 --- a/source/views/directory/detail.android.tsx +++ b/source/views/directory/detail.android.tsx @@ -1,26 +1,30 @@ import React from 'react' -import {ScrollView, View, Text, StyleSheet} from 'react-native' -import {openUrl} from '@frogpond/open-url' -import {callPhone} from '../../components/call-phone' -import {sendEmail} from '../../components/send-email' -import {buildEmailAction, buildPhoneActions} from './helpers' -import * as c from '@frogpond/colors' -import type {CampusLocation, Department} from './types' +import {ScrollView, StyleSheet, Text, View} from 'react-native' + import { Avatar, - Title, - Subheading, Chip, FAB, List, Portal, + Subheading, + Title, } from 'react-native-paper' -import {RouteProp, useRoute, useNavigation} from '@react-navigation/native' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' import { NativeStackNavigationOptions, NativeStackNavigationProp, } from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' +import {openUrl} from '@frogpond/open-url' + import {RootStackParamList} from '../../../source/navigation/types' +import {callPhone} from '../../components/call-phone' +import {sendEmail} from '../../components/send-email' +import {buildEmailAction, buildPhoneActions} from './helpers' +import type {CampusLocation, Department} from './types' export const DetailNavigationOptions: NativeStackNavigationOptions = { title: 'Contact', diff --git a/source/views/directory/detail.ios.tsx b/source/views/directory/detail.ios.tsx index e478c42fdf..c04229ba1f 100644 --- a/source/views/directory/detail.ios.tsx +++ b/source/views/directory/detail.ios.tsx @@ -1,19 +1,22 @@ import React from 'react' -import {ScrollView, Text, StyleSheet, Image} from 'react-native' -import {openUrl} from '@frogpond/open-url' -import {callPhone} from '../../components/call-phone' -import {sendEmail} from '../../components/send-email' -import {Title, Detail} from '@frogpond/lists' -import {TableView, Section, Cell} from '@frogpond/tableview' -import {MultiLineLeftDetailCell} from '@frogpond/tableview/cells' -import * as c from '@frogpond/colors' -import type {Department, CampusLocation} from './types' -import {RouteProp, useRoute, useNavigation} from '@react-navigation/native' +import {Image, ScrollView, StyleSheet, Text} from 'react-native' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' import { NativeStackNavigationOptions, NativeStackNavigationProp, } from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' +import {Detail, Title} from '@frogpond/lists' +import {openUrl} from '@frogpond/open-url' +import {Cell, Section, TableView} from '@frogpond/tableview' +import {MultiLineLeftDetailCell} from '@frogpond/tableview/cells' + import {RootStackParamList} from '../../../source/navigation/types' +import {callPhone} from '../../components/call-phone' +import {sendEmail} from '../../components/send-email' +import type {CampusLocation, Department} from './types' export const DetailNavigationOptions: NativeStackNavigationOptions = { title: 'Contact', diff --git a/source/views/directory/detail.ts b/source/views/directory/detail.ts index b7bd6afac5..4a5b8f79e8 100644 --- a/source/views/directory/detail.ts +++ b/source/views/directory/detail.ts @@ -1,13 +1,13 @@ import {Platform} from 'react-native' import { - DirectoryDetailView as IosDetail, - DetailNavigationOptions as IosNavigationOptions, -} from './detail.ios' -import { - DirectoryDetailView as AndroidDetail, DetailNavigationOptions as AndroidNavigationOptions, + DirectoryDetailView as AndroidDetail, } from './detail.android' +import { + DetailNavigationOptions as IosNavigationOptions, + DirectoryDetailView as IosDetail, +} from './detail.ios' export const DirectoryDetailView = Platform.OS === 'ios' ? IosDetail : AndroidDetail diff --git a/source/views/directory/helpers.ts b/source/views/directory/helpers.ts index ad45539f64..88fc3ec671 100644 --- a/source/views/directory/helpers.ts +++ b/source/views/directory/helpers.ts @@ -1,16 +1,11 @@ import {ComponentProps} from 'react' -import {callPhone} from '../../components/call-phone' -import {sendEmail} from '../../components/send-email' -import {decode} from '@frogpond/html-lib' + import {FAB} from 'react-native-paper' -// We can pull unexported props out with the built-in type utility from react -// and flatten the array into just the object underneath -type Flatten = Type extends Array ? Item : Type -type RNPaperFABGroupAction = Flatten< - ComponentProps<(typeof FAB)['Group']>['actions'] -> +import {decode} from '@frogpond/html-lib' +import {callPhone} from '../../components/call-phone' +import {sendEmail} from '../../components/send-email' import type { CampusLocation, DirectoryItem, @@ -18,6 +13,13 @@ import type { SearchResults, } from './types' +// We can pull unexported props out with the built-in type utility from react +// and flatten the array into just the object underneath +type Flatten = Type extends Array ? Item : Type +type RNPaperFABGroupAction = Flatten< + ComponentProps<(typeof FAB)['Group']>['actions'] +> + export const buildPhoneActions = ( loc: CampusLocation, locationsCount: number, diff --git a/source/views/directory/index.ts b/source/views/directory/index.ts index 0d36bcf0ab..5eef8f0efc 100644 --- a/source/views/directory/index.ts +++ b/source/views/directory/index.ts @@ -1,2 +1,2 @@ +export {DetailNavigationOptions, DirectoryDetailView} from './detail' export {DirectoryView, NavigationOptions} from './list' -export {DirectoryDetailView, DetailNavigationOptions} from './detail' diff --git a/source/views/directory/list.tsx b/source/views/directory/list.tsx index 3eaa7f44d1..aea82c6793 100644 --- a/source/views/directory/list.tsx +++ b/source/views/directory/list.tsx @@ -8,22 +8,26 @@ import { Text, View, } from 'react-native' -import {Column} from '@frogpond/layout' -import {Detail, ListRow, ListSeparator, Title} from '@frogpond/lists' -import * as c from '@frogpond/colors' -import {useDebounce} from '@frogpond/use-debounce' -import {LoadingView, NoticeView} from '@frogpond/notice' -import {formatResults} from './helpers' -import {useDirectoryEntries} from './query' + import {Avatar, List} from 'react-native-paper' -import type {DirectoryItem, DirectorySearchTypeEnum} from './types' import Icon from 'react-native-vector-icons/Ionicons' + import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' import { NativeStackNavigationOptions, NativeStackNavigationProp, } from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' +import {Column} from '@frogpond/layout' +import {Detail, ListRow, ListSeparator, Title} from '@frogpond/lists' +import {LoadingView, NoticeView} from '@frogpond/notice' +import {useDebounce} from '@frogpond/use-debounce' + import {ChangeTextEvent, RootStackParamList} from '../../navigation/types' +import {formatResults} from './helpers' +import {useDirectoryEntries} from './query' +import type {DirectoryItem, DirectorySearchTypeEnum} from './types' export const NavigationKey = 'Directory' diff --git a/source/views/directory/query.ts b/source/views/directory/query.ts index e89e7fc6bf..ab324f3631 100644 --- a/source/views/directory/query.ts +++ b/source/views/directory/query.ts @@ -1,6 +1,6 @@ -import ky from 'ky' -import {useQuery, UseQueryResult} from '@tanstack/react-query' import {DirectorySearchTypeEnum, SearchResults} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' +import ky from 'ky' let directory = ky.create({prefixUrl: 'https://www.stolaf.edu/directory'}) diff --git a/source/views/faqs/index.tsx b/source/views/faqs/index.tsx index 18cc837102..7271c76faa 100644 --- a/source/views/faqs/index.tsx +++ b/source/views/faqs/index.tsx @@ -1,9 +1,12 @@ import * as React from 'react' -import {RefreshControl, StyleSheet, ScrollView, View} from 'react-native' +import {RefreshControl, ScrollView, StyleSheet, View} from 'react-native' + +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' import {Markdown} from '@frogpond/markdown' import {LoadingView, NoticeView} from '@frogpond/notice' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {useFaqs} from './query' const styles = StyleSheet.create({ diff --git a/source/views/faqs/query.ts b/source/views/faqs/query.ts index 9b7eaf539c..33b04c1e14 100644 --- a/source/views/faqs/query.ts +++ b/source/views/faqs/query.ts @@ -1,4 +1,5 @@ import {client} from '@frogpond/api' + import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { diff --git a/source/views/home/button.tsx b/source/views/home/button.tsx index 4df5e60858..9bfce85e7e 100644 --- a/source/views/home/button.tsx +++ b/source/views/home/button.tsx @@ -1,11 +1,14 @@ import * as React from 'react' import {Platform, SafeAreaView, StyleSheet, Text, View} from 'react-native' + +import {hasNotch} from 'react-native-device-info' import Icon from 'react-native-vector-icons/Entypo' -import type {ViewType} from '../views' -import {Touchable} from '@frogpond/touchable' + import {transparent} from '@frogpond/colors' +import {Touchable} from '@frogpond/touchable' + +import type {ViewType} from '../views' import {homescreenForegroundDark, homescreenForegroundLight} from './colors' -import {hasNotch} from 'react-native-device-info' type Props = { view: ViewType diff --git a/source/views/home/index.tsx b/source/views/home/index.tsx index 89a17dfa20..c70dd26de8 100644 --- a/source/views/home/index.tsx +++ b/source/views/home/index.tsx @@ -1,15 +1,17 @@ import * as React from 'react' -import {ScrollView, View, StyleSheet} from 'react-native' +import {ScrollView, StyleSheet, View} from 'react-native' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {allViews} from '../views' import {Column} from '@frogpond/layout' -import {partitionByIndex} from '../../lib/partition-by-index' -import {HomeScreenButton, CELL_MARGIN} from './button' -import {openUrl} from '@frogpond/open-url' import {OpenSettingsButton} from '@frogpond/navigation-buttons' +import {openUrl} from '@frogpond/open-url' + +import {partitionByIndex} from '../../lib/partition-by-index' +import {allViews} from '../views' +import {CELL_MARGIN, HomeScreenButton} from './button' import {UnofficialAppNotice} from './notice' -import {useNavigation} from '@react-navigation/native' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' const styles = StyleSheet.create({ cells: { diff --git a/source/views/home/notice.tsx b/source/views/home/notice.tsx index b38a0571ee..1e6530b5d0 100644 --- a/source/views/home/notice.tsx +++ b/source/views/home/notice.tsx @@ -1,10 +1,12 @@ import React from 'react' -import {View, Text, StyleSheet} from 'react-native' +import {StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' -import sample from 'lodash/sample' -import {CELL_MARGIN} from './button' import {isDevMode} from '@frogpond/constants' +import {CELL_MARGIN} from './button' +import sample from 'lodash/sample' + let messages = [ '☃️ An Unofficial App Project ☃️', 'For students, by students', diff --git a/source/views/menus/carleton-menus.tsx b/source/views/menus/carleton-menus.tsx index 829dc996da..720b3f9a65 100644 --- a/source/views/menus/carleton-menus.tsx +++ b/source/views/menus/carleton-menus.tsx @@ -1,11 +1,14 @@ import * as React from 'react' import {Platform, ScrollView, StyleSheet, View} from 'react-native' -import {Row} from '@frogpond/layout' -import {ListRow, ListSeparator, Title} from '@frogpond/lists' -import {BonAppHostedMenu} from './menu-bonapp' + import {useNavigation} from '@react-navigation/native' import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {Row} from '@frogpond/layout' +import {ListRow, ListSeparator, Title} from '@frogpond/lists' + import {CafeMenuParamList} from '../../navigation/types' +import {BonAppHostedMenu} from './menu-bonapp' export const CarletonBurtonMenuScreen = (): JSX.Element => ( ( diff --git a/source/views/menus/lib/__tests__/find-menu.test.ts b/source/views/menus/lib/__tests__/find-menu.test.ts index dd1aeec7d1..c72c733178 100644 --- a/source/views/menus/lib/__tests__/find-menu.test.ts +++ b/source/views/menus/lib/__tests__/find-menu.test.ts @@ -1,8 +1,8 @@ -import {expect, it} from '@jest/globals' import {findMenu} from '../../../../../modules/food-menu/lib/find-menu' -import moment from 'moment-timezone' import type {DayPartsCollectionType} from '../../types' +import {expect, it} from '@jest/globals' import uniqueId from 'lodash/uniqueId' +import moment from 'moment-timezone' const CENTRAL_TZ = 'America/Chicago' diff --git a/source/views/menus/lib/__tests__/menu-item.mock.ts b/source/views/menus/lib/__tests__/menu-item.mock.ts index dfb6b4c348..eac43d1956 100644 --- a/source/views/menus/lib/__tests__/menu-item.mock.ts +++ b/source/views/menus/lib/__tests__/menu-item.mock.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ -import type {MenuItemType} from '../../types' import type {ItemCorIconMapType} from '../../../../../modules/food-menu/types' +import type {MenuItemType} from '../../types' export const item: (params: { cor_icon?: ItemCorIconMapType diff --git a/source/views/menus/lib/__tests__/trim-names.test.ts b/source/views/menus/lib/__tests__/trim-names.test.ts index 17e81ac6ae..8f8f4f881f 100644 --- a/source/views/menus/lib/__tests__/trim-names.test.ts +++ b/source/views/menus/lib/__tests__/trim-names.test.ts @@ -1,5 +1,5 @@ -import {describe, expect, it} from '@jest/globals' import {trimItemLabel, trimStationName} from '../trim-names' +import {describe, expect, it} from '@jest/globals' describe('trimStationName', () => { it('should remove the html tags and @ prefix', () => { diff --git a/source/views/menus/menu-bonapp.tsx b/source/views/menus/menu-bonapp.tsx index 516672bba2..b354034e29 100644 --- a/source/views/menus/menu-bonapp.tsx +++ b/source/views/menus/menu-bonapp.tsx @@ -1,8 +1,14 @@ import * as React from 'react' + import {timezone} from '@frogpond/constants' -import {SUPPORT_EMAIL} from '../../lib/constants' -import {LoadingView, NoticeView} from '@frogpond/notice' import {FoodMenu} from '@frogpond/food-menu' +import {decode, innerTextWithSpaces, parseHtml} from '@frogpond/html-lib' +import {LoadingView, NoticeView} from '@frogpond/notice' +import {toLaxTitleCase} from '@frogpond/titlecase' + +import {SUPPORT_EMAIL} from '../../lib/constants' +import {trimItemLabel, trimStationName} from './lib/trim-names' +import {useBonAppCafe, useBonAppMenu} from './query' import type { DayPartMenuType, EditedBonAppCafeInfoType as CafeInfoType, @@ -12,13 +18,9 @@ import type { ProcessedMealType, StationMenuType, } from './types' -import sample from 'lodash/sample' import {mapValues, reduce} from 'lodash' +import sample from 'lodash/sample' import moment, {type Moment} from 'moment-timezone' -import {trimItemLabel, trimStationName} from './lib/trim-names' -import {useBonAppCafe, useBonAppMenu} from './query' -import {decode, innerTextWithSpaces, parseHtml} from '@frogpond/html-lib' -import {toLaxTitleCase} from '@frogpond/titlecase' const BONAPP_HTML_ERROR_CODE = 'bonapp-html' diff --git a/source/views/menus/menu-github.tsx b/source/views/menus/menu-github.tsx index 7b43537296..a88d0bed51 100644 --- a/source/views/menus/menu-github.tsx +++ b/source/views/menus/menu-github.tsx @@ -1,10 +1,12 @@ import * as React from 'react' + import {timezone} from '@frogpond/constants' -import {LoadingView, NoticeView} from '@frogpond/notice' import {FoodMenu} from '@frogpond/food-menu' -import moment from 'moment-timezone' -import sample from 'lodash/sample' +import {LoadingView, NoticeView} from '@frogpond/notice' + import {usePauseMenu} from './query' +import sample from 'lodash/sample' +import moment from 'moment-timezone' type Props = { name: string diff --git a/source/views/menus/query.ts b/source/views/menus/query.ts index 8aa1fa0364..da9b083433 100644 --- a/source/views/menus/query.ts +++ b/source/views/menus/query.ts @@ -1,6 +1,5 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' -import {groupBy} from 'lodash' + import {upgradeMenuItem, upgradeStation} from './lib/process-menu-shorthands' import type { EditedBonAppCafeInfoType, @@ -11,6 +10,8 @@ import type { MenuItemType, StationMenuType, } from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' +import {groupBy} from 'lodash' export const menuKeys = { bonAppCcc: (cafePath: string) => ['cafe-menu', 'bonApp', cafePath] as const, diff --git a/source/views/menus/types.ts b/source/views/menus/types.ts index 2d32c7e41b..86378ef698 100644 --- a/source/views/menus/types.ts +++ b/source/views/menus/types.ts @@ -1,22 +1,22 @@ import type { - MenuItemType, - StationMenuType, - MenuItemContainerType, + CorIconType, + DayPartMenuType, + DayPartsCollectionType, MasterCorIconMapType, + MenuItemContainerType, + MenuItemType, ProcessedMealType, - DayPartsCollectionType, - DayPartMenuType, - CorIconType, + StationMenuType, } from '@frogpond/food-menu' export type { - MenuItemType, - StationMenuType, - MenuItemContainerType, + DayPartMenuType, + DayPartsCollectionType, MasterCorIconMapType, + MenuItemContainerType, + MenuItemType, ProcessedMealType, - DayPartsCollectionType, - DayPartMenuType, + StationMenuType, } export type NumericStringType = string diff --git a/source/views/more/index.tsx b/source/views/more/index.tsx index 6b8a7e8a70..b0a24c96a4 100644 --- a/source/views/more/index.tsx +++ b/source/views/more/index.tsx @@ -1,25 +1,26 @@ import * as React from 'react' import {SectionList, StyleSheet} from 'react-native' +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import {useDebounce} from '@frogpond/use-debounce' -import {LoadingView, NoticeView} from '@frogpond/notice' -import {openUrl} from '@frogpond/open-url' import {Row} from '@frogpond/layout' import { - ListSeparator, - ListSectionHeader, largeListProps, - Title, ListRow, + ListSectionHeader, + ListSeparator, + Title, } from '@frogpond/lists' -import {LinkValue} from './types' +import {LoadingView, NoticeView} from '@frogpond/notice' +import {openUrl} from '@frogpond/open-url' +import {useDebounce} from '@frogpond/use-debounce' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {useNavigation} from '@react-navigation/native' import {ChangeTextEvent} from '../../navigation/types' -import {deburr, words} from 'lodash' import {useSearchLinks} from './query' +import {LinkValue} from './types' +import {deburr, words} from 'lodash' const styles = StyleSheet.create({ wrapper: { diff --git a/source/views/more/query.ts b/source/views/more/query.ts index 4533c7b525..16ee0918a6 100644 --- a/source/views/more/query.ts +++ b/source/views/more/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' + import {LinkGroup} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { all: ['a-z'] as const, diff --git a/source/views/news/index.tsx b/source/views/news/index.tsx index 9f22cd6f83..0db06a9a83 100644 --- a/source/views/news/index.tsx +++ b/source/views/news/index.tsx @@ -1,10 +1,12 @@ import * as React from 'react' import {Platform} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import { - MaterialIcon, - IosIcon, createTabNavigator, + IosIcon, + MaterialIcon, type Tab, } from '@frogpond/navigation-tabs' diff --git a/source/views/news/lib/__tests__/clean-entries.test.ts b/source/views/news/lib/__tests__/clean-entries.test.ts index 9a72cee580..aa127d2eec 100644 --- a/source/views/news/lib/__tests__/clean-entries.test.ts +++ b/source/views/news/lib/__tests__/clean-entries.test.ts @@ -1,5 +1,5 @@ -import {describe, expect, it} from '@jest/globals' import {cleanEntries} from '../util' +import {describe, expect, it} from '@jest/globals' describe('cleanEntries', () => { let rest = {authors: [], categories: [], title: ''} diff --git a/source/views/news/lib/__tests__/trim-categories.test.ts b/source/views/news/lib/__tests__/trim-categories.test.ts index 7c70ca95c1..f115bd3a7f 100644 --- a/source/views/news/lib/__tests__/trim-categories.test.ts +++ b/source/views/news/lib/__tests__/trim-categories.test.ts @@ -1,5 +1,5 @@ -import {describe, expect, it} from '@jest/globals' import {trimStoryCateogry} from '../util' +import {describe, expect, it} from '@jest/globals' describe('trimStoryCategory', () => { it('should remove extraneous whitespace from the input', () => { diff --git a/source/views/news/lib/util.ts b/source/views/news/lib/util.ts index 8663d55294..d06f7062cc 100644 --- a/source/views/news/lib/util.ts +++ b/source/views/news/lib/util.ts @@ -1,5 +1,6 @@ import {decode} from '@frogpond/html-lib' import {toLaxTitleCase} from '@frogpond/titlecase' + import {StoryType} from '../types' // remove all entries with blank excerpts diff --git a/source/views/news/news-list.tsx b/source/views/news/news-list.tsx index d32091b552..a89633290c 100644 --- a/source/views/news/news-list.tsx +++ b/source/views/news/news-list.tsx @@ -1,13 +1,15 @@ import * as React from 'react' import {FlatList, StyleSheet} from 'react-native' -import type {StoryType} from './types' + import * as c from '@frogpond/colors' +import {FilterToolbar, ListType} from '@frogpond/filter' import {ListSeparator} from '@frogpond/lists' import {LoadingView, NoticeView} from '@frogpond/notice' import {openUrl} from '@frogpond/open-url' -import {NewsRow} from './news-row' + import {cleanEntries, trimStoryCateogry} from './lib/util' -import {FilterToolbar, ListType} from '@frogpond/filter' +import {NewsRow} from './news-row' +import type {StoryType} from './types' import {UseQueryResult} from '@tanstack/react-query' type Props = { diff --git a/source/views/news/news-row.tsx b/source/views/news/news-row.tsx index a734c6843b..887e6f477c 100644 --- a/source/views/news/news-row.tsx +++ b/source/views/news/news-row.tsx @@ -1,7 +1,9 @@ import * as React from 'react' -import {StyleSheet, Image, Alert} from 'react-native' +import {Alert, Image, StyleSheet} from 'react-native' + import {Column, Row} from '@frogpond/layout' -import {ListRow, Detail, Title} from '@frogpond/lists' +import {Detail, ListRow, Title} from '@frogpond/lists' + import type {StoryType} from './types' type Props = { diff --git a/source/views/news/query.ts b/source/views/news/query.ts index bb40a26c25..55dccff23c 100644 --- a/source/views/news/query.ts +++ b/source/views/news/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, type UseQueryResult} from '@tanstack/react-query' + import {StoryType} from './types' +import {useQuery, type UseQueryResult} from '@tanstack/react-query' export const keys = { named: (name: string) => ['news', 'named', name] as const, diff --git a/source/views/settings/components/logo.tsx b/source/views/settings/components/logo.tsx index dd74533bbb..b6289263bf 100644 --- a/source/views/settings/components/logo.tsx +++ b/source/views/settings/components/logo.tsx @@ -1,12 +1,14 @@ import React from 'react' import { - StyleProp, - ImageStyle, Image, - StyleSheet, ImageProps, + ImageStyle, + StyleProp, + StyleSheet, } from 'react-native' + import * as Icons from '@hawkrives/react-native-alternate-icons' + import {lookup as getAppIcon} from '../../../../images/icons/index' const styles = StyleSheet.create({ diff --git a/source/views/settings/index.ts b/source/views/settings/index.ts index 92a1e97930..867d2adbc3 100644 --- a/source/views/settings/index.ts +++ b/source/views/settings/index.ts @@ -1,28 +1,28 @@ // General settings -export { - View as SettingsView, - NavigationOptions as SettingsNavigationOptions, -} from './screens/overview' export {IconSettingsView} from './screens/change-icon' export {CreditsView} from './screens/credits' export {LegalView} from './screens/legal' +export { + NavigationOptions as SettingsNavigationOptions, + View as SettingsView, +} from './screens/overview' export {PrivacyView} from './screens/privacy' // Developer settings +export {APITestNavigationOptions, APITestView} from './screens/api-test' export {DebugRootView} from './screens/debug' -export {APITestView, APITestNavigationOptions} from './screens/api-test' export { - NetworkLoggerView, NavigationOptions as NetworkLoggerNavigationOptions, + NetworkLoggerView, } from './screens/network-logger' // Component library export { - ComponentLibrary, - ComponentLibraryNavigationOptions, BadgeLibrary, ButtonLibrary, ColorsLibrary, ColorsLibraryNavigationKey, + ComponentLibrary, + ComponentLibraryNavigationOptions, ContextMenuLibrary, } from './screens/overview/component-library' diff --git a/source/views/settings/screens/api-test/api-test.tsx b/source/views/settings/screens/api-test/api-test.tsx index d22774a64b..eb72dfca14 100644 --- a/source/views/settings/screens/api-test/api-test.tsx +++ b/source/views/settings/screens/api-test/api-test.tsx @@ -1,22 +1,24 @@ import * as React from 'react' -import * as c from '@frogpond/colors' -import {Platform, StyleSheet, TextInput, Text, View} from 'react-native' +import {Platform, StyleSheet, Text, TextInput, View} from 'react-native' + +import {iOSUIKit, material} from 'react-native-typography' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {client} from '@frogpond/api' -import {useDebounce} from '@frogpond/use-debounce' -import {useQuery} from '@tanstack/react-query' -import {CellToggle} from '@frogpond/tableview/cells' +import * as c from '@frogpond/colors' import {HtmlContent} from '@frogpond/html-content' import {Icon} from '@frogpond/icon' import {CloseScreenButton} from '@frogpond/navigation-buttons' +import {CellToggle} from '@frogpond/tableview/cells' +import {useDebounce} from '@frogpond/use-debounce' -import {useNavigation} from '@react-navigation/native' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {iOSUIKit, material} from 'react-native-typography' - +import {ChangeTextEvent} from '../../../../navigation/types' import {DebugView} from '../debug' import {syntaxHighlight} from './util/highlight' import {CSS_CODE_STYLES} from './util/highlight-styles' -import {ChangeTextEvent} from '../../../../navigation/types' +import {useQuery} from '@tanstack/react-query' const styles = StyleSheet.create({ container: { diff --git a/source/views/settings/screens/api-test/index.ts b/source/views/settings/screens/api-test/index.ts index 9d8c22dbf3..23383a2d99 100644 --- a/source/views/settings/screens/api-test/index.ts +++ b/source/views/settings/screens/api-test/index.ts @@ -1,4 +1,4 @@ export { - APITestView, NavigationOptions as APITestNavigationOptions, + APITestView, } from './api-test' diff --git a/source/views/settings/screens/change-icon.tsx b/source/views/settings/screens/change-icon.tsx index c3e12a6708..29b20defe7 100644 --- a/source/views/settings/screens/change-icon.tsx +++ b/source/views/settings/screens/change-icon.tsx @@ -1,9 +1,11 @@ import * as React from 'react' import {Image, ImageSourcePropType, StyleSheet} from 'react-native' -import * as Icons from '@hawkrives/react-native-alternate-icons' + +import * as c from '@frogpond/colors' import {Cell, Section} from '@frogpond/tableview' +import * as Icons from '@hawkrives/react-native-alternate-icons' + import {icons as appIcons} from '../../../../images/icons' -import * as c from '@frogpond/colors' const styles = StyleSheet.create({ icon: { diff --git a/source/views/settings/screens/credits.tsx b/source/views/settings/screens/credits.tsx index b5af0edb5d..614f3d223d 100644 --- a/source/views/settings/screens/credits.tsx +++ b/source/views/settings/screens/credits.tsx @@ -1,7 +1,10 @@ import * as React from 'react' -import * as c from '@frogpond/colors' -import {Platform, ScrollView, StyleSheet, TextProps, Text} from 'react-native' +import {Platform, ScrollView, StyleSheet, Text, TextProps} from 'react-native' + import {iOSUIKit, material} from 'react-native-typography' + +import * as c from '@frogpond/colors' + import {AppLogo} from '../components/logo' const styles = StyleSheet.create({ diff --git a/source/views/settings/screens/debug/list.tsx b/source/views/settings/screens/debug/list.tsx index 9813b283e3..977866cbfa 100644 --- a/source/views/settings/screens/debug/list.tsx +++ b/source/views/settings/screens/debug/list.tsx @@ -1,12 +1,16 @@ import * as React from 'react' import {FlatList, ScrollView, StyleSheet, Text} from 'react-native' -import {DebugRow} from './row' -import {NoticeView} from '@frogpond/notice' -import {ListSeparator} from '@frogpond/lists' -import {useAppSelector} from '../../../../redux' + +import {Section, TableView} from 'react-native-tableview-simple' + import {RouteProp, useNavigation, useRoute} from '@react-navigation/core' + +import {ListSeparator} from '@frogpond/lists' +import {NoticeView} from '@frogpond/notice' + import {SettingsStackParamList} from '../../../../navigation/types' -import {Section, TableView} from 'react-native-tableview-simple' +import {useAppSelector} from '../../../../redux' +import {DebugRow} from './row' export const NavigationKey = 'DebugView' as const diff --git a/source/views/settings/screens/debug/row.tsx b/source/views/settings/screens/debug/row.tsx index a20727a9b0..25ac27519e 100644 --- a/source/views/settings/screens/debug/row.tsx +++ b/source/views/settings/screens/debug/row.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {Cell} from '@frogpond/tableview' type Props = { diff --git a/source/views/settings/screens/legal.tsx b/source/views/settings/screens/legal.tsx index 7053f5ca82..4120d4e9fb 100644 --- a/source/views/settings/screens/legal.tsx +++ b/source/views/settings/screens/legal.tsx @@ -1,5 +1,6 @@ import React from 'react' import {ScrollView, StyleSheet} from 'react-native' + import * as c from '@frogpond/colors' import * as m from '@frogpond/markdown' diff --git a/source/views/settings/screens/network-logger/index.tsx b/source/views/settings/screens/network-logger/index.tsx index a07d81ffc0..4cca11e378 100644 --- a/source/views/settings/screens/network-logger/index.tsx +++ b/source/views/settings/screens/network-logger/index.tsx @@ -1,17 +1,20 @@ import * as React from 'react' import { - StyleSheet, Platform, - View, + StyleSheet, Text, TouchableOpacity, useColorScheme, + View, } from 'react-native' -import {Button} from '@frogpond/button' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import NetworkLogger, {getBackHandler} from 'react-native-network-logger' -import {CloseScreenButton} from '@frogpond/navigation-buttons' + +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {Button} from '@frogpond/button' import * as c from '@frogpond/colors' +import {CloseScreenButton} from '@frogpond/navigation-buttons' export const NetworkLoggerView = (): JSX.Element => { const goBack = () => setUnmountNetworkLogger(true) diff --git a/source/views/settings/screens/overview/app-icon.tsx b/source/views/settings/screens/overview/app-icon.tsx index a87c6d445c..eae2d97654 100644 --- a/source/views/settings/screens/overview/app-icon.tsx +++ b/source/views/settings/screens/overview/app-icon.tsx @@ -1,5 +1,7 @@ import * as React from 'react' + import * as Icons from '@hawkrives/react-native-alternate-icons' + import {IconSettingsView} from '../change-icon' export const AppIconSection = (): JSX.Element | null => { diff --git a/source/views/settings/screens/overview/component-library/badge.tsx b/source/views/settings/screens/overview/component-library/badge.tsx index e09ed19838..fcda09f4ac 100644 --- a/source/views/settings/screens/overview/component-library/badge.tsx +++ b/source/views/settings/screens/overview/component-library/badge.tsx @@ -1,9 +1,11 @@ import * as React from 'react' import {Platform, StyleSheet} from 'react-native' -import * as c from '@frogpond/colors' + import {OutlineBadge, SolidBadge} from '@frogpond/badge' +import * as c from '@frogpond/colors' import {Section} from '@frogpond/tableview' -import {LibraryWrapper, Example} from './base/library-wrapper' + +import {Example, LibraryWrapper} from './base/library-wrapper' const OutlineBadgeExamples = (): JSX.Element => (
diff --git a/source/views/settings/screens/overview/component-library/base/library-wrapper.tsx b/source/views/settings/screens/overview/component-library/base/library-wrapper.tsx index 0527288a53..68a8a3e467 100644 --- a/source/views/settings/screens/overview/component-library/base/library-wrapper.tsx +++ b/source/views/settings/screens/overview/component-library/base/library-wrapper.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import {ScrollView, StyleProp, StyleSheet, ViewStyle} from 'react-native' -import {TableView, Cell} from '@frogpond/tableview' + +import {Cell, TableView} from '@frogpond/tableview' interface WrapperProps { children: JSX.Element diff --git a/source/views/settings/screens/overview/component-library/button.tsx b/source/views/settings/screens/overview/component-library/button.tsx index a9b876011c..a1190f3cac 100644 --- a/source/views/settings/screens/overview/component-library/button.tsx +++ b/source/views/settings/screens/overview/component-library/button.tsx @@ -1,11 +1,12 @@ import * as React from 'react' import {Alert} from 'react-native' +import {Button} from '@frogpond/button' import * as c from '@frogpond/colors' import {Section} from '@frogpond/tableview' -import {Button} from '@frogpond/button' import {ButtonCell} from '@frogpond/tableview/cells' -import {LibraryWrapper, Example} from './base/library-wrapper' + +import {Example, LibraryWrapper} from './base/library-wrapper' const ButtonCellExample = (): JSX.Element => { return ( diff --git a/source/views/settings/screens/overview/component-library/colors.tsx b/source/views/settings/screens/overview/component-library/colors.tsx index 50c682c8fd..3ed80d9c08 100644 --- a/source/views/settings/screens/overview/component-library/colors.tsx +++ b/source/views/settings/screens/overview/component-library/colors.tsx @@ -21,7 +21,9 @@ import { Text, View, } from 'react-native' + import {Section} from '@frogpond/tableview' + import {LibraryWrapper} from './base/library-wrapper' function createTable(): Array<{ diff --git a/source/views/settings/screens/overview/component-library/context-menu.tsx b/source/views/settings/screens/overview/component-library/context-menu.tsx index e0d819c6ac..c57156ed61 100644 --- a/source/views/settings/screens/overview/component-library/context-menu.tsx +++ b/source/views/settings/screens/overview/component-library/context-menu.tsx @@ -1,7 +1,9 @@ import * as React from 'react' + +import {Button} from '@frogpond/button' import {ContextMenu} from '@frogpond/context-menu' import {Section} from '@frogpond/tableview' -import {Button} from '@frogpond/button' + import {Example, LibraryWrapper} from './base/library-wrapper' import {upperFirst} from 'lodash' diff --git a/source/views/settings/screens/overview/component-library/index.tsx b/source/views/settings/screens/overview/component-library/index.tsx index 61e0b194fe..14b98d4e47 100644 --- a/source/views/settings/screens/overview/component-library/index.tsx +++ b/source/views/settings/screens/overview/component-library/index.tsx @@ -1,12 +1,11 @@ -export { - ComponentLibrary, - NavigationOptions as ComponentLibraryNavigationOptions, -} from './library' - export {BadgeLibrary} from './badge' export {ButtonLibrary} from './button' -export {ContextMenuLibrary} from './context-menu' export { ColorsLibrary, NavigationKey as ColorsLibraryNavigationKey, } from './colors' +export {ContextMenuLibrary} from './context-menu' +export { + ComponentLibrary, + NavigationOptions as ComponentLibraryNavigationOptions, +} from './library' diff --git a/source/views/settings/screens/overview/component-library/library.tsx b/source/views/settings/screens/overview/component-library/library.tsx index 2b421cc358..e51918b2c2 100644 --- a/source/views/settings/screens/overview/component-library/library.tsx +++ b/source/views/settings/screens/overview/component-library/library.tsx @@ -1,12 +1,13 @@ import * as React from 'react' import {Platform} from 'react-native' -import {CloseScreenButton} from '@frogpond/navigation-buttons' -import {TableView, Section} from '@frogpond/tableview' -import {PushButtonCell} from '@frogpond/tableview/cells' import {useNavigation} from '@react-navigation/native' import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import {CloseScreenButton} from '@frogpond/navigation-buttons' +import {Section, TableView} from '@frogpond/tableview' +import {PushButtonCell} from '@frogpond/tableview/cells' + import {NavigationKey as ColorsLibrNavigationKey} from './colors' export const ComponentLibrary = (): JSX.Element => { diff --git a/source/views/settings/screens/overview/developer.tsx b/source/views/settings/screens/overview/developer.tsx index 0dd467901c..c63ef3e54c 100644 --- a/source/views/settings/screens/overview/developer.tsx +++ b/source/views/settings/screens/overview/developer.tsx @@ -1,12 +1,15 @@ -import * as Sentry from '@sentry/react-native' import * as React from 'react' import {Alert} from 'react-native' + +import {useNavigation} from '@react-navigation/native' + +import {isDevMode} from '@frogpond/constants' import {Section} from '@frogpond/tableview' import {PushButtonCell} from '@frogpond/tableview/cells' -import {isDevMode} from '@frogpond/constants' -import {ServerUrlSection} from './server-url' -import {useNavigation} from '@react-navigation/native' + import {NavigationKey as DebugKey} from '../debug' +import {ServerUrlSection} from './server-url' +import * as Sentry from '@sentry/react-native' export const DeveloperSection = (): React.ReactElement => { let navigation = useNavigation() diff --git a/source/views/settings/screens/overview/index.tsx b/source/views/settings/screens/overview/index.tsx index cdd9ec7f7c..93862fe431 100644 --- a/source/views/settings/screens/overview/index.tsx +++ b/source/views/settings/screens/overview/index.tsx @@ -1,16 +1,17 @@ import * as React from 'react' -import {StyleSheet, ScrollView, Platform} from 'react-native' -import {TableView} from '@frogpond/tableview' -import {CloseScreenButton} from '@frogpond/navigation-buttons' +import {Platform, ScrollView, StyleSheet} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' import {isDevMode} from '@frogpond/constants' +import {CloseScreenButton} from '@frogpond/navigation-buttons' +import {TableView} from '@frogpond/tableview' +import {AppIconSection} from './app-icon' +import {DeveloperSection} from './developer' import {CredentialsLoginSection} from './login-credentials' import {MiscellanySection} from './miscellany' import {SupportSection} from './support' -import {DeveloperSection} from './developer' -import {AppIconSection} from './app-icon' const styles = StyleSheet.create({ container: { diff --git a/source/views/settings/screens/overview/login-button.tsx b/source/views/settings/screens/overview/login-button.tsx index 1c1010688c..81ac9331f9 100644 --- a/source/views/settings/screens/overview/login-button.tsx +++ b/source/views/settings/screens/overview/login-button.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {ButtonCell} from '@frogpond/tableview/cells' type Props = { diff --git a/source/views/settings/screens/overview/login-credentials.tsx b/source/views/settings/screens/overview/login-credentials.tsx index 191a133e47..082cb95619 100644 --- a/source/views/settings/screens/overview/login-credentials.tsx +++ b/source/views/settings/screens/overview/login-credentials.tsx @@ -1,17 +1,19 @@ import * as React from 'react' +import {TextInput} from 'react-native' + import {Cell, Section} from '@frogpond/tableview' import {CellTextField} from '@frogpond/tableview/cells' -import {LoginButton} from './login-button' + +import {sto} from '../../../../lib/colors' import { - performLogin, - useCredentials, invalidateCredentials, - storeCredentials, + performLogin, resetCredentials, + storeCredentials, + useCredentials, } from '../../../../lib/login' -import {TextInput} from 'react-native' +import {LoginButton} from './login-button' import {useMutation} from '@tanstack/react-query' -import {sto} from '../../../../lib/colors' export const CredentialsLoginSection = (): JSX.Element => { let [username, setUsername] = React.useState('') diff --git a/source/views/settings/screens/overview/miscellany.tsx b/source/views/settings/screens/overview/miscellany.tsx index 6c1cf1c331..dbaaa24526 100644 --- a/source/views/settings/screens/overview/miscellany.tsx +++ b/source/views/settings/screens/overview/miscellany.tsx @@ -1,10 +1,13 @@ import * as React from 'react' + +import {useNavigation} from '@react-navigation/native' + +import {trackedOpenUrl} from '@frogpond/open-url' import {Section} from '@frogpond/tableview' import {CellToggle, PushButtonCell} from '@frogpond/tableview/cells' -import {trackedOpenUrl} from '@frogpond/open-url' + import {GH_BASE_URL} from '../../../../lib/constants' import * as storage from '../../../../lib/storage' -import {useNavigation} from '@react-navigation/native' export let MiscellanySection = (): JSX.Element => { let navigation = useNavigation() diff --git a/source/views/settings/screens/overview/server-url.tsx b/source/views/settings/screens/overview/server-url.tsx index 329ccf3936..7c5aeb59c1 100644 --- a/source/views/settings/screens/overview/server-url.tsx +++ b/source/views/settings/screens/overview/server-url.tsx @@ -1,10 +1,13 @@ import * as React from 'react' import {StyleSheet} from 'react-native' -import {Section} from '@frogpond/tableview' -import {CellTextField, ButtonCell} from '@frogpond/tableview/cells' + import restart from 'react-native-restart' -import * as storage from '../../../../lib/storage' + +import {Section} from '@frogpond/tableview' +import {ButtonCell, CellTextField} from '@frogpond/tableview/cells' + import {DEFAULT_URL} from '../../../../lib/constants' +import * as storage from '../../../../lib/storage' import {useMutation, useQuery} from '@tanstack/react-query' export const ServerUrlSection = (): React.ReactElement => { diff --git a/source/views/settings/screens/overview/support.tsx b/source/views/settings/screens/overview/support.tsx index b6a7542d32..62ed07af08 100644 --- a/source/views/settings/screens/overview/support.tsx +++ b/source/views/settings/screens/overview/support.tsx @@ -1,12 +1,16 @@ import * as React from 'react' import {Alert} from 'react-native' -import {Section, Cell} from '@frogpond/tableview' + +import deviceInfo from 'react-native-device-info' + +import {useNavigation} from '@react-navigation/native' + +import {appBuild, appVersion} from '@frogpond/constants' +import {Cell, Section} from '@frogpond/tableview' import {PushButtonCell} from '@frogpond/tableview/cells' + import {sendEmail} from '../../../../components/send-email' -import deviceInfo from 'react-native-device-info' -import {appVersion, appBuild} from '@frogpond/constants' import {refreshApp} from '../../../../lib/refresh' -import {useNavigation} from '@react-navigation/native' const getDeviceInfo = () => ` diff --git a/source/views/settings/screens/privacy.tsx b/source/views/settings/screens/privacy.tsx index 3b229dee85..5ca065392a 100644 --- a/source/views/settings/screens/privacy.tsx +++ b/source/views/settings/screens/privacy.tsx @@ -1,5 +1,6 @@ import React from 'react' import {ScrollView, StyleSheet} from 'react-native' + import * as c from '@frogpond/colors' import * as m from '@frogpond/markdown' diff --git a/source/views/sis/balances-acknowledgement.tsx b/source/views/sis/balances-acknowledgement.tsx index 9b98e726a8..d9498fc775 100644 --- a/source/views/sis/balances-acknowledgement.tsx +++ b/source/views/sis/balances-acknowledgement.tsx @@ -1,17 +1,20 @@ import * as React from 'react' import {Platform, ScrollView, StyleSheet, View} from 'react-native' + +import {Avatar, Button, Card, Paragraph as AndroidP} from 'react-native-paper' import Icon from 'react-native-vector-icons/Ionicons' + +import {Button as IosButton} from '@frogpond/button' +import * as c from '@frogpond/colors' +import {Paragraph as IosP} from '@frogpond/markdown' +import {Card as IosCard} from '@frogpond/silly-card' + import {useAppDispatch, useAppSelector} from '../../redux' import { acknowledgeAcknowledgement, selectAcknowledgement, } from '../../redux/parts/settings' -import {Avatar, Button, Card, Paragraph as AndroidP} from 'react-native-paper' -import {Paragraph as IosP} from '@frogpond/markdown' -import {Card as IosCard} from '@frogpond/silly-card' -import {Button as IosButton} from '@frogpond/button' import {BalancesView} from './balances' -import * as c from '@frogpond/colors' let Paragraph = Platform.OS === 'android' ? AndroidP : IosP let Ack = Platform.OS === 'android' ? AndroidAck : IosAck diff --git a/source/views/sis/balances.tsx b/source/views/sis/balances.tsx index 931d56dc10..db69bf8743 100644 --- a/source/views/sis/balances.tsx +++ b/source/views/sis/balances.tsx @@ -1,18 +1,21 @@ import * as React from 'react' import { - StyleSheet, - ScrollView, - View, - Text, RefreshControl, + ScrollView, StyleProp, + StyleSheet, + Text, + View, ViewStyle, } from 'react-native' -import {Cell, TableView, Section} from '@frogpond/tableview' -import {BalancesShapeType, useBalances} from '../../lib/financials' + +import {useNavigation} from '@react-navigation/native' + import * as c from '@frogpond/colors' +import {Cell, Section, TableView} from '@frogpond/tableview' + import {sto} from '../../lib/colors' -import {useNavigation} from '@react-navigation/native' +import {BalancesShapeType, useBalances} from '../../lib/financials' import {NoCredentialsError, useUsername} from '../../lib/login' const DISCLAIMER = 'This data may be outdated or otherwise inaccurate.' diff --git a/source/views/sis/components/recents-list.tsx b/source/views/sis/components/recents-list.tsx index 33d07fb8fe..a588c56743 100644 --- a/source/views/sis/components/recents-list.tsx +++ b/source/views/sis/components/recents-list.tsx @@ -1,8 +1,10 @@ import * as React from 'react' -import {StyleSheet, Text, View, Platform, Pressable} from 'react-native' -import {ListSeparator, ListRow} from '@frogpond/lists' -import {NoticeView} from '@frogpond/notice' +import {Platform, Pressable, StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' +import {ListRow, ListSeparator} from '@frogpond/lists' +import {NoticeView} from '@frogpond/notice' + import {noop} from 'lodash' type Props = { diff --git a/source/views/sis/course-search/detail/index.tsx b/source/views/sis/course-search/detail/index.tsx index 306b4bb711..2cad53fdb5 100644 --- a/source/views/sis/course-search/detail/index.tsx +++ b/source/views/sis/course-search/detail/index.tsx @@ -1,31 +1,34 @@ import * as React from 'react' -import {timezone} from '@frogpond/constants' import { - StyleSheet, - Text, Platform, - ScrollViewProps, ScrollView, + ScrollViewProps, + StyleSheet, + Text, TextProps, } from 'react-native' -import type {CourseType} from '../../../../lib/course-search' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import {SolidBadge as Badge} from '@frogpond/badge' -import moment from 'moment-timezone' -import {formatDay} from '../lib/format-day' -import {TableView, Section, Cell} from '@frogpond/tableview' +import * as c from '@frogpond/colors' +import {timezone} from '@frogpond/constants' +import {Cell, Section, TableView} from '@frogpond/tableview' import { - SelectableCell, MultiLineDetailCell, MultiLineLeftDetailCell, + SelectableCell, } from '@frogpond/tableview/cells' -import * as c from '@frogpond/colors' + +import type {CourseType} from '../../../../lib/course-search' +import {RootStackParamList} from '../../../../navigation/types' +import {formatDay} from '../lib/format-day' import {deptNum} from '../lib/format-dept-num' import groupBy from 'lodash/groupBy' import map from 'lodash/map' import zip from 'lodash/zip' -import {RouteProp, useRoute} from '@react-navigation/native' -import {RootStackParamList} from '../../../../navigation/types' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import moment from 'moment-timezone' const Container = (props: ScrollViewProps) => ( diff --git a/source/views/sis/course-search/index.ts b/source/views/sis/course-search/index.ts index 7fccc458b4..5a30a15574 100644 --- a/source/views/sis/course-search/index.ts +++ b/source/views/sis/course-search/index.ts @@ -1,12 +1,12 @@ export { - CourseSearchView, - NavigationOptions as CourseSearchViewNavigationOptions, -} from './search' + CourseDetailView, + NavigationOptions as CourseSearchDetailNavigationOptions, +} from './detail' export { - CourseSearchResultsView, NavigationOptions as CourseSearchNavigationOptions, + CourseSearchResultsView, } from './results' export { - CourseDetailView, - NavigationOptions as CourseSearchDetailNavigationOptions, -} from './detail' + CourseSearchView, + NavigationOptions as CourseSearchViewNavigationOptions, +} from './search' diff --git a/source/views/sis/course-search/lib/build-filters.ts b/source/views/sis/course-search/lib/build-filters.ts index 3db31bcb3a..58ebcc7081 100644 --- a/source/views/sis/course-search/lib/build-filters.ts +++ b/source/views/sis/course-search/lib/build-filters.ts @@ -1,6 +1,7 @@ -import {parseTerm} from '../../../../lib/course-search/parse-term' import type {FilterType, ListType, ToggleType} from '@frogpond/filter' + import {CourseType} from '../../../../lib/course-search' +import {parseTerm} from '../../../../lib/course-search/parse-term' import {useAvailableTerms, useDepartments, useGeReqs} from '../query' export function useFilters(): { diff --git a/source/views/sis/course-search/lib/execute-search.ts b/source/views/sis/course-search/lib/execute-search.ts index c0fbcea67d..dc248396a8 100644 --- a/source/views/sis/course-search/lib/execute-search.ts +++ b/source/views/sis/course-search/lib/execute-search.ts @@ -1,6 +1,6 @@ import type {CourseType as Course} from '../../../../lib/course-search' -import keywordSearch from 'keyword-search' import {deptNum} from './format-dept-num' +import keywordSearch from 'keyword-search' import groupBy from 'lodash/groupBy' import sortBy from 'lodash/sortBy' import toPairs from 'lodash/toPairs' diff --git a/source/views/sis/course-search/lib/format-filter-combo.ts b/source/views/sis/course-search/lib/format-filter-combo.ts index 5efa60cce8..19823157e0 100644 --- a/source/views/sis/course-search/lib/format-filter-combo.ts +++ b/source/views/sis/course-search/lib/format-filter-combo.ts @@ -1,7 +1,8 @@ -import {filterListSpecs} from '@frogpond/filter' import type {FilterType} from '@frogpond/filter' -import {formatTerms} from './format-terms' +import {filterListSpecs} from '@frogpond/filter' + import {CourseType} from '../../../../lib/course-search' +import {formatTerms} from './format-terms' export type FilterComboType = { filters: FilterType[] diff --git a/source/views/sis/course-search/lib/format-terms.ts b/source/views/sis/course-search/lib/format-terms.ts index 39a05da966..5ee0d182c6 100644 --- a/source/views/sis/course-search/lib/format-terms.ts +++ b/source/views/sis/course-search/lib/format-terms.ts @@ -1,6 +1,6 @@ import groupBy from 'lodash/groupBy' -import sortBy from 'lodash/sortBy' import mapValues from 'lodash/mapValues' +import sortBy from 'lodash/sortBy' import toPairs from 'lodash/toPairs' //example: [20171,20173,20154,20153] -> "17/18: Fall/Spr, "15/16: Spr/Sum1"" diff --git a/source/views/sis/course-search/query.ts b/source/views/sis/course-search/query.ts index 3ffd35f78d..71782c787c 100644 --- a/source/views/sis/course-search/query.ts +++ b/source/views/sis/course-search/query.ts @@ -1,9 +1,3 @@ -import { - useQueries, - useQuery, - UseQueryOptions, - UseQueryResult, -} from '@tanstack/react-query' import {CourseType, TermType} from '../../../lib/course-search' import { coursesForTerm, @@ -11,6 +5,12 @@ import { geData, infoJson, } from '../../../lib/course-search/urls' +import { + useQueries, + useQuery, + UseQueryOptions, + UseQueryResult, +} from '@tanstack/react-query' const ONE_SECOND = 1000 const ONE_MINUTE = ONE_SECOND * 60 diff --git a/source/views/sis/course-search/results.tsx b/source/views/sis/course-search/results.tsx index b62740ca29..e9dc0ee1ef 100644 --- a/source/views/sis/course-search/results.tsx +++ b/source/views/sis/course-search/results.tsx @@ -1,30 +1,30 @@ import * as React from 'react' -import {StyleSheet, SectionList, ActivityIndicator, Text} from 'react-native' -import { - updateRecentSearches, - updateRecentFilters, -} from '../../../redux/parts/courses' -import {LoadingView} from '@frogpond/notice' -import type {CourseType} from '../../../lib/course-search' -import {useAppDispatch} from '../../../redux' -import {applyFiltersToItem} from '@frogpond/filter' -import {FilterType} from '@frogpond/filter' -import {useFilters} from './lib/build-filters' +import {ActivityIndicator, SectionList, StyleSheet, Text} from 'react-native' + import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' -import {ChangeTextEvent, RootStackParamList} from '../../../navigation/types' import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {useDebounce} from '@frogpond/use-debounce' -import {ListSeparator, ListSectionHeader, largeListProps} from '@frogpond/lists' + import * as c from '@frogpond/colors' -import {CourseRow} from './row' -import memoize from 'lodash/memoize' -import {parseTerm} from '../../../lib/course-search' -import {NoticeView} from '@frogpond/notice' -import {FilterToolbar} from '@frogpond/filter' +import {applyFiltersToItem, FilterToolbar, FilterType} from '@frogpond/filter' import {ListSpecType} from '@frogpond/filter/types' +import {largeListProps, ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {LoadingView, NoticeView} from '@frogpond/notice' +import {useDebounce} from '@frogpond/use-debounce' + +import type {CourseType} from '../../../lib/course-search' +import {parseTerm} from '../../../lib/course-search' +import {ChangeTextEvent, RootStackParamList} from '../../../navigation/types' +import {useAppDispatch} from '../../../redux' +import { + updateRecentFilters, + updateRecentSearches, +} from '../../../redux/parts/courses' +import {useFilters} from './lib/build-filters' import {applySearch, sortAndGroupResults} from './lib/execute-search' import {useCourseData} from './query' +import {CourseRow} from './row' import {UseQueryResult} from '@tanstack/react-query' +import memoize from 'lodash/memoize' function doSearch(args: { query: string diff --git a/source/views/sis/course-search/row.tsx b/source/views/sis/course-search/row.tsx index d1296805fa..3c4e2930fb 100644 --- a/source/views/sis/course-search/row.tsx +++ b/source/views/sis/course-search/row.tsx @@ -1,9 +1,11 @@ import * as React from 'react' import {StyleSheet} from 'react-native' + +import {Row} from '@frogpond/layout' +import {Detail, ListRow, Title} from '@frogpond/lists' + import type {CourseType} from '../../../lib/course-search/types' -import {ListRow, Title, Detail} from '@frogpond/lists' import {deptNum} from './lib/format-dept-num' -import {Row} from '@frogpond/layout' type Props = { course: CourseType diff --git a/source/views/sis/course-search/search.tsx b/source/views/sis/course-search/search.tsx index ef25d7b261..0a3beb4579 100644 --- a/source/views/sis/course-search/search.tsx +++ b/source/views/sis/course-search/search.tsx @@ -1,11 +1,13 @@ -import * as c from '@frogpond/colors' -import {LoadingView, NoticeView} from '@frogpond/notice' -import {SearchButton} from '@frogpond/navigation-buttons' -import {useNavigation} from '@react-navigation/native' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {debounce, fromPairs} from 'lodash' import * as React from 'react' import {ScrollView, StyleSheet, View} from 'react-native' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' +import {SearchButton} from '@frogpond/navigation-buttons' +import {LoadingView, NoticeView} from '@frogpond/notice' + import {ChangeTextEvent} from '../../../navigation/types' import {useAppSelector} from '../../../redux' import { @@ -14,6 +16,7 @@ import { } from '../../../redux/parts/courses' import {RecentItemsList} from '../components/recents-list' import {useFilters} from './lib/build-filters' +import {debounce, fromPairs} from 'lodash' let _debounce = debounce((query: string, callback: () => void) => { if (query.length >= 2) { diff --git a/source/views/sis/index.tsx b/source/views/sis/index.tsx index f259599579..0269cf14fe 100644 --- a/source/views/sis/index.tsx +++ b/source/views/sis/index.tsx @@ -1,24 +1,26 @@ import {Platform} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import { - MaterialIcon, - IosIcon, createTabNavigator, + IosIcon, + MaterialIcon, type Tab, } from '@frogpond/navigation-tabs' import {BalancesOrAcknowledgementView} from './balances-acknowledgement' import {View as StudentWorkView} from './student-work' -export * as studentwork from './student-work' export { - CourseSearchView, - CourseSearchResultsView, CourseDetailView, + CourseSearchDetailNavigationOptions, CourseSearchNavigationOptions, + CourseSearchResultsView, + CourseSearchView, CourseSearchViewNavigationOptions, - CourseSearchDetailNavigationOptions, } from './course-search' +export * as studentwork from './student-work' type Params = { BalancesView: undefined diff --git a/source/views/sis/student-work/detail-android.tsx b/source/views/sis/student-work/detail-android.tsx index 76a9c37668..fca7b408be 100644 --- a/source/views/sis/student-work/detail-android.tsx +++ b/source/views/sis/student-work/detail-android.tsx @@ -1,17 +1,20 @@ import * as React from 'react' -import {Text, View, ScrollView, StyleSheet} from 'react-native' -import {sendEmail} from '../../../components/send-email' -import {callPhone} from '../../../components/call-phone' -import {Card} from '@frogpond/silly-card' -import moment from 'moment' -import {openUrl} from '@frogpond/open-url' +import {ScrollView, StyleSheet, Text, View} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import type {JobType} from './types' import {ShareButton} from '@frogpond/navigation-buttons' -import {shareJob} from './lib' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useRoute} from '@react-navigation/native' +import {openUrl} from '@frogpond/open-url' +import {Card} from '@frogpond/silly-card' + +import {callPhone} from '../../../components/call-phone' +import {sendEmail} from '../../../components/send-email' import {RootStackParamList} from '../../../navigation/types' +import {shareJob} from './lib' +import type {JobType} from './types' +import moment from 'moment' const styles = StyleSheet.create({ name: { diff --git a/source/views/sis/student-work/detail-ios.tsx b/source/views/sis/student-work/detail-ios.tsx index fd66dc5d0a..1814fc1d1b 100644 --- a/source/views/sis/student-work/detail-ios.tsx +++ b/source/views/sis/student-work/detail-ios.tsx @@ -1,19 +1,22 @@ import * as React from 'react' -import {Text, ScrollView, StyleSheet, TextProps} from 'react-native' -import {sendEmail} from '../../../components/send-email' -import {callPhone} from '../../../components/call-phone' -import {Cell, Section, TableView} from '@frogpond/tableview' -import {SelectableCell, PushButtonCell} from '@frogpond/tableview/cells' -import {openUrl} from '@frogpond/open-url' -import moment from 'moment' +import {ScrollView, StyleSheet, Text, TextProps} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import type {JobType} from './types' -import {ShareButton} from '@frogpond/navigation-buttons' -import {shareJob} from './lib' import {decode} from '@frogpond/html-lib' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useRoute} from '@react-navigation/native' +import {ShareButton} from '@frogpond/navigation-buttons' +import {openUrl} from '@frogpond/open-url' +import {Cell, Section, TableView} from '@frogpond/tableview' +import {PushButtonCell, SelectableCell} from '@frogpond/tableview/cells' + +import {callPhone} from '../../../components/call-phone' +import {sendEmail} from '../../../components/send-email' import {RootStackParamList} from '../../../navigation/types' +import {shareJob} from './lib' +import type {JobType} from './types' +import moment from 'moment' const styles = StyleSheet.create({ lastUpdated: { diff --git a/source/views/sis/student-work/detail.tsx b/source/views/sis/student-work/detail.tsx index 65998e4a73..5c53b26990 100644 --- a/source/views/sis/student-work/detail.tsx +++ b/source/views/sis/student-work/detail.tsx @@ -1,13 +1,13 @@ import {Platform} from 'react-native' import { - View as IosDetail, - NavigationOptions as IosDetailNavigationOptions, -} from './detail-ios' -import { - View as AndroidDetail, NavigationOptions as AndroidDetailNavigationOptions, + View as AndroidDetail, } from './detail-android' +import { + NavigationOptions as IosDetailNavigationOptions, + View as IosDetail, +} from './detail-ios' const StudentWorkDetailView = Platform.OS === 'ios' ? IosDetail : AndroidDetail diff --git a/source/views/sis/student-work/index.tsx b/source/views/sis/student-work/index.tsx index 57a8df686e..fcb65f6403 100644 --- a/source/views/sis/student-work/index.tsx +++ b/source/views/sis/student-work/index.tsx @@ -1,13 +1,16 @@ import * as React from 'react' -import {StyleSheet, SectionList} from 'react-native' +import {SectionList, StyleSheet} from 'react-native' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import {ListSeparator, ListSectionHeader} from '@frogpond/lists' -import {NoticeView, LoadingView} from '@frogpond/notice' +import {ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {LoadingView, NoticeView} from '@frogpond/notice' + import {JobRow} from './job-row' -import type {JobType} from './types' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {useNavigation} from '@react-navigation/native' import {useStudentWorkPostings} from './query' +import type {JobType} from './types' const styles = StyleSheet.create({ listContainer: { diff --git a/source/views/sis/student-work/job-row.tsx b/source/views/sis/student-work/job-row.tsx index 0e6bbb4663..5d72d30dea 100644 --- a/source/views/sis/student-work/job-row.tsx +++ b/source/views/sis/student-work/job-row.tsx @@ -1,7 +1,9 @@ import * as React from 'react' -import {Column, Row} from '@frogpond/layout' -import {ListRow, Detail, Title} from '@frogpond/lists' + import {fastGetTrimmedText} from '@frogpond/html-lib' +import {Column, Row} from '@frogpond/layout' +import {Detail, ListRow, Title} from '@frogpond/lists' + import type {JobType} from './types' type Props = { diff --git a/source/views/sis/student-work/lib.ts b/source/views/sis/student-work/lib.ts index fdeea4a08f..2643d333c0 100644 --- a/source/views/sis/student-work/lib.ts +++ b/source/views/sis/student-work/lib.ts @@ -1,4 +1,5 @@ import {Platform, Share} from 'react-native' + import type {JobType} from './types' export function shareJob(job: JobType): void { diff --git a/source/views/sis/student-work/query.ts b/source/views/sis/student-work/query.ts index 2e284e1acc..b38bbddfaf 100644 --- a/source/views/sis/student-work/query.ts +++ b/source/views/sis/student-work/query.ts @@ -1,7 +1,8 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' -import {JobType} from './types' import {toLaxTitleCase as titleCase} from '@frogpond/titlecase' + +import {JobType} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' import {groupBy, orderBy} from 'lodash' export const keys = { diff --git a/source/views/stoprint/components/error.tsx b/source/views/stoprint/components/error.tsx index b581e76754..3d7203b797 100644 --- a/source/views/stoprint/components/error.tsx +++ b/source/views/stoprint/components/error.tsx @@ -1,8 +1,11 @@ import * as React from 'react' import {Platform, RefreshControl, ScrollView, StyleSheet} from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' -import {NoticeView} from '@frogpond/notice' + import * as c from '@frogpond/colors' +import {NoticeView} from '@frogpond/notice' + import {openEmail} from '../../settings/screens/overview/support' const ERROR_MESSAGE = diff --git a/source/views/stoprint/components/notice.tsx b/source/views/stoprint/components/notice.tsx index bf54206e86..9f290e8c3a 100644 --- a/source/views/stoprint/components/notice.tsx +++ b/source/views/stoprint/components/notice.tsx @@ -6,9 +6,11 @@ import { StyleSheet, Text, } from 'react-native' + import Icon from 'react-native-vector-icons/Ionicons' -import {NoticeView} from '@frogpond/notice' + import * as c from '@frogpond/colors' +import {NoticeView} from '@frogpond/notice' type Props = { buttonText: string diff --git a/source/views/stoprint/index.ts b/source/views/stoprint/index.ts index ea1fb0b49a..95015ff046 100644 --- a/source/views/stoprint/index.ts +++ b/source/views/stoprint/index.ts @@ -1,12 +1,12 @@ export { - PrintJobsView, NavigationOptions as PrintJobsNavigationOptions, + PrintJobsView, } from './print-jobs' export { - PrinterListView, - NavigationOptions as PrinterListNavigationOptions, -} from './printers' -export { - PrintJobReleaseView, NavigationOptions as PrintJobReleaseNavigationOptions, + PrintJobReleaseView, } from './print-release' +export { + NavigationOptions as PrinterListNavigationOptions, + PrinterListView, +} from './printers' diff --git a/source/views/stoprint/lib.ts b/source/views/stoprint/lib.ts index 8933b1514c..63fdc8526d 100644 --- a/source/views/stoprint/lib.ts +++ b/source/views/stoprint/lib.ts @@ -1,7 +1,8 @@ -const TIME_FORMAT = 'h:mm:ss A' import {timezone} from '@frogpond/constants' -import moment from 'moment-timezone' + import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' +const TIME_FORMAT = 'h:mm:ss A' const parseTime = (now: Moment, time: string): null | Moment => { // interpret in Central time diff --git a/source/views/stoprint/print-jobs.tsx b/source/views/stoprint/print-jobs.tsx index 6e41eb2e7e..d7f580e11c 100644 --- a/source/views/stoprint/print-jobs.tsx +++ b/source/views/stoprint/print-jobs.tsx @@ -1,8 +1,10 @@ import * as React from 'react' -import {timezone} from '@frogpond/constants' import {Platform, SectionList} from 'react-native' -import type {PrintJob} from '../../lib/stoprint' -import {STOPRINT_HELP_PAGE, isStoprintMocked} from '../../lib/stoprint' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import {timezone} from '@frogpond/constants' import { Detail, ListRow, @@ -10,19 +12,20 @@ import { ListSeparator, Title, } from '@frogpond/lists' +import {DebugNoticeButton} from '@frogpond/navigation-buttons' import {LoadingView} from '@frogpond/notice' import {openUrl} from '@frogpond/open-url' +import {useMomentTimer} from '@frogpond/timer' + +import {useHasCredentials} from '../../lib/login' +import type {PrintJob} from '../../lib/stoprint' +import {isStoprintMocked, STOPRINT_HELP_PAGE} from '../../lib/stoprint' import {StoPrintErrorView, StoPrintNoticeView} from './components' -import groupBy from 'lodash/groupBy' -import toPairs from 'lodash/toPairs' -import sortBy from 'lodash/sortBy' import {getTimeRemaining} from './lib' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {useNavigation} from '@react-navigation/native' -import {DebugNoticeButton} from '@frogpond/navigation-buttons' -import {useMomentTimer} from '@frogpond/timer' import {usePrintJobs} from './query' -import {useHasCredentials} from '../../lib/login' +import groupBy from 'lodash/groupBy' +import sortBy from 'lodash/sortBy' +import toPairs from 'lodash/toPairs' export const PrintJobsView = (): JSX.Element => { let {now} = useMomentTimer({intervalMs: 60000, timezone: timezone()}) diff --git a/source/views/stoprint/print-release.tsx b/source/views/stoprint/print-release.tsx index 31c1ccaea6..13ae378978 100644 --- a/source/views/stoprint/print-release.tsx +++ b/source/views/stoprint/print-release.tsx @@ -1,26 +1,29 @@ import * as React from 'react' -import {Alert, StyleSheet, ScrollView, Text, TextProps} from 'react-native' -import {TableView, Section, Cell} from '@frogpond/tableview' -import {ButtonCell} from '@frogpond/tableview/cells' +import {Alert, ScrollView, StyleSheet, Text, TextProps} from 'react-native' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import { - cancelPrintJobForUser, - releasePrintJobToPrinterForUser, -} from '../../lib/stoprint/api' +import {DebugNoticeButton} from '@frogpond/navigation-buttons' +import {LoadingView} from '@frogpond/notice' +import {Cell, Section, TableView} from '@frogpond/tableview' +import {ButtonCell} from '@frogpond/tableview/cells' + +import {useUsername} from '../../lib/login' import { isStoprintMocked, - showGeneralError, type Printer, type PrintJob, + showGeneralError, } from '../../lib/stoprint' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import { + cancelPrintJobForUser, + releasePrintJobToPrinterForUser, +} from '../../lib/stoprint/api' import {RootStackParamList} from '../../navigation/types' -import {DebugNoticeButton} from '@frogpond/navigation-buttons' import {useHeldJobs} from './query' import {useMutation} from '@tanstack/react-query' -import {useUsername} from '../../lib/login' -import {LoadingView} from '@frogpond/notice' const styles = StyleSheet.create({ cancelButton: { diff --git a/source/views/stoprint/printers.tsx b/source/views/stoprint/printers.tsx index 220e275686..cb8b6fb8b1 100644 --- a/source/views/stoprint/printers.tsx +++ b/source/views/stoprint/printers.tsx @@ -1,7 +1,9 @@ import * as React from 'react' import {SectionList, StyleSheet} from 'react-native' -import type {Printer} from '../../lib/stoprint' -import {isStoprintMocked} from '../../lib/stoprint' + +import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import { Detail, ListRow, @@ -9,15 +11,16 @@ import { ListSeparator, Title, } from '@frogpond/lists' -import {LoadingView} from '@frogpond/notice' import {DebugNoticeButton} from '@frogpond/navigation-buttons' -import groupBy from 'lodash/groupBy' -import {StoPrintErrorView} from './components/error' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useNavigation, useRoute} from '@react-navigation/native' +import {LoadingView} from '@frogpond/notice' + +import type {Printer} from '../../lib/stoprint' +import {isStoprintMocked} from '../../lib/stoprint' +import {RecentPopularPrintersResponse} from '../../lib/stoprint/types' import {RootStackParamList} from '../../navigation/types' +import {StoPrintErrorView} from './components/error' import {useAllPrinters, useColorPrinters, useRecentPrinters} from './query' -import {RecentPopularPrintersResponse} from '../../lib/stoprint/types' +import groupBy from 'lodash/groupBy' const styles = StyleSheet.create({ list: {}, diff --git a/source/views/stoprint/query.ts b/source/views/stoprint/query.ts index 418690e46b..eb757be942 100644 --- a/source/views/stoprint/query.ts +++ b/source/views/stoprint/query.ts @@ -1,4 +1,3 @@ -import {useQuery, UseQueryResult} from '@tanstack/react-query' import {useUsername} from '../../lib/login' import { fetchAllPrinters, @@ -13,6 +12,7 @@ import { PrintJobsResponse, RecentPopularPrintersResponse, } from '../../lib/stoprint/types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { jobs: (username: string) => ['printing', 'jobs', 'all', username] as const, diff --git a/source/views/streaming/index.tsx b/source/views/streaming/index.tsx index 8da0d2cb38..e5c0130532 100644 --- a/source/views/streaming/index.tsx +++ b/source/views/streaming/index.tsx @@ -1,19 +1,21 @@ import {Platform} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import { - MaterialIcon, - IosIcon, createTabNavigator, + IosIcon, + MaterialIcon, type Tab, } from '@frogpond/navigation-tabs' import {WeeklyMovieView} from './movie' -import {WebcamsView} from './webcams' -import {StreamListView} from './streams' -import {KstoStationView} from './radio/station-ksto' import {KrlxStationView} from './radio/station-krlx' +import {KstoStationView} from './radio/station-ksto' +import {StreamListView} from './streams' +import {WebcamsView} from './webcams' -export {KSTOScheduleView, KRLXScheduleView} from './radio' +export {KRLXScheduleView, KSTOScheduleView} from './radio' type Params = { StreamingView: undefined diff --git a/source/views/streaming/movie.tsx b/source/views/streaming/movie.tsx index fbb898c348..c3f4674abf 100644 --- a/source/views/streaming/movie.tsx +++ b/source/views/streaming/movie.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import {StyleSheet, View, Text} from 'react-native' +import {StyleSheet, Text, View} from 'react-native' export function WeeklyMovieView(): JSX.Element { return ( diff --git a/source/views/streaming/radio/buttons.tsx b/source/views/streaming/radio/buttons.tsx index b6e760bcae..ba4278a609 100644 --- a/source/views/streaming/radio/buttons.tsx +++ b/source/views/streaming/radio/buttons.tsx @@ -1,9 +1,11 @@ import * as React from 'react' import {Platform, StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' import type {Glyphs} from '@frogpond/icon' import {Icon} from '@frogpond/icon' import {Touchable} from '@frogpond/touchable' + import {useTheme} from './theme' type ActionButtonProps = { diff --git a/source/views/streaming/radio/controller.tsx b/source/views/streaming/radio/controller.tsx index f62ac125aa..a6f9385987 100644 --- a/source/views/streaming/radio/controller.tsx +++ b/source/views/streaming/radio/controller.tsx @@ -5,20 +5,23 @@ import { ScrollView, StyleSheet, Text, - View, useWindowDimensions, + View, } from 'react-native' -import noop from 'lodash/noop' + +import {useNavigation} from '@react-navigation/native' + import * as c from '@frogpond/colors' -import {callPhone} from '../../../components/call-phone' import {Row} from '@frogpond/layout' -import {StreamPlayer} from './player' -import type {HtmlAudioError, PlayState} from './types' -import {useTheme} from './theme' -import {ActionButton, CallButton, ShowCalendarButton} from './buttons' import {openUrl} from '@frogpond/open-url' -import {useNavigation} from '@react-navigation/native' + +import {callPhone} from '../../../components/call-phone' import {RadioScheduleParamList} from '../../../navigation/types' +import {ActionButton, CallButton, ShowCalendarButton} from './buttons' +import {StreamPlayer} from './player' +import {useTheme} from './theme' +import type {HtmlAudioError, PlayState} from './types' +import noop from 'lodash/noop' // If you want to fix the inline player, switch to `true` const ALLOW_INLINE_PLAYER = false diff --git a/source/views/streaming/radio/index.ts b/source/views/streaming/radio/index.ts index 37919b0c66..1a2fed7889 100644 --- a/source/views/streaming/radio/index.ts +++ b/source/views/streaming/radio/index.ts @@ -1,2 +1,2 @@ export {RadioControllerView} from './controller' -export {KSTOScheduleView, KRLXScheduleView} from './schedule' +export {KRLXScheduleView, KSTOScheduleView} from './schedule' diff --git a/source/views/streaming/radio/player.tsx b/source/views/streaming/radio/player.tsx index 1297d907cc..54b2cef2d4 100644 --- a/source/views/streaming/radio/player.tsx +++ b/source/views/streaming/radio/player.tsx @@ -1,8 +1,10 @@ import * as React from 'react' import {useCallback, useEffect, useRef} from 'react' +import {StyleProp, ViewStyle} from 'react-native' + import {WebView, WebViewMessageEvent} from 'react-native-webview' + import type {HtmlAudioError, PlayState} from './types' -import {StyleProp, ViewStyle} from 'react-native' type Props = { playState: PlayState diff --git a/source/views/streaming/radio/schedule.tsx b/source/views/streaming/radio/schedule.tsx index 3b5cf6e7ea..76811834b5 100644 --- a/source/views/streaming/radio/schedule.tsx +++ b/source/views/streaming/radio/schedule.tsx @@ -1,4 +1,5 @@ import * as React from 'react' + import {CccCalendarView, useNamedCalendar} from '@frogpond/ccc-calendar' import {EventType} from '@frogpond/event-type' diff --git a/source/views/streaming/radio/station-krlx.tsx b/source/views/streaming/radio/station-krlx.tsx index 0ca40c9ff9..f654974bce 100644 --- a/source/views/streaming/radio/station-krlx.tsx +++ b/source/views/streaming/radio/station-krlx.tsx @@ -1,9 +1,11 @@ import * as React from 'react' + import * as c from '@frogpond/colors' + import * as logos from '../../../../images/streaming' import {RadioControllerView} from './index' -import tinycolor from 'tinycolor2' import {PlayerTheme, ThemeProvider} from './theme' +import tinycolor from 'tinycolor2' let tintColor = '#33348e' const colors: PlayerTheme = { diff --git a/source/views/streaming/radio/station-ksto.tsx b/source/views/streaming/radio/station-ksto.tsx index ed2904f9f5..3fd5db405e 100644 --- a/source/views/streaming/radio/station-ksto.tsx +++ b/source/views/streaming/radio/station-ksto.tsx @@ -1,9 +1,10 @@ import * as React from 'react' -import {sto} from '../../../lib/colors' + import * as logos from '../../../../images/streaming' +import {sto} from '../../../lib/colors' import {RadioControllerView} from './index' -import tinycolor from 'tinycolor2' import {PlayerTheme, ThemeProvider} from './theme' +import tinycolor from 'tinycolor2' let tintColor = '#37a287' const colors: PlayerTheme = { diff --git a/source/views/streaming/radio/theme.ts b/source/views/streaming/radio/theme.ts index 20332c2dec..8d638af0ea 100644 --- a/source/views/streaming/radio/theme.ts +++ b/source/views/streaming/radio/theme.ts @@ -19,4 +19,4 @@ const defaultTheme: PlayerTheme = { let {ThemeProvider, withTheme, useTheme} = createTheming(defaultTheme) -export {ThemeProvider, withTheme, useTheme} +export {ThemeProvider, useTheme, withTheme} diff --git a/source/views/streaming/streams/list.tsx b/source/views/streaming/streams/list.tsx index fc9b3f2265..244de6781b 100644 --- a/source/views/streaming/streams/list.tsx +++ b/source/views/streaming/streams/list.tsx @@ -1,17 +1,19 @@ import * as React from 'react' -import {StyleSheet, SectionList} from 'react-native' +import {SectionList, StyleSheet} from 'react-native' + import * as c from '@frogpond/colors' -import {ListSeparator, ListSectionHeader} from '@frogpond/lists' -import {NoticeView, LoadingView} from '@frogpond/notice' import {FilterToolbar, ListType} from '@frogpond/filter' +import {ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {LoadingView, NoticeView} from '@frogpond/notice' +import {toLaxTitleCase as titleCase} from '@frogpond/titlecase' + +import {useStreams} from './query' import {StreamRow} from './row' -import toPairs from 'lodash/toPairs' +import type {StreamType} from './types' import groupBy from 'lodash/groupBy' -import moment from 'moment-timezone' +import toPairs from 'lodash/toPairs' import type {Moment} from 'moment-timezone' -import {toLaxTitleCase as titleCase} from '@frogpond/titlecase' -import type {StreamType} from './types' -import {useStreams} from './query' +import moment from 'moment-timezone' const styles = StyleSheet.create({ listContainer: { diff --git a/source/views/streaming/streams/query.ts b/source/views/streaming/streams/query.ts index ccea3e81e3..91228c647a 100644 --- a/source/views/streaming/streams/query.ts +++ b/source/views/streaming/streams/query.ts @@ -1,8 +1,9 @@ import {client} from '@frogpond/api' +import {timezone} from '@frogpond/constants' + +import {StreamType} from './types' import {useQuery, UseQueryResult} from '@tanstack/react-query' import moment, {type Moment} from 'moment-timezone' -import {StreamType} from './types' -import {timezone} from '@frogpond/constants' export const keys = { all: (filter: {sort: 'ascending'; dateFrom: string; dateTo: string}) => diff --git a/source/views/streaming/streams/row.tsx b/source/views/streaming/streams/row.tsx index c04ae6d765..4d9422f3fe 100644 --- a/source/views/streaming/streams/row.tsx +++ b/source/views/streaming/streams/row.tsx @@ -1,12 +1,13 @@ import * as React from 'react' -import {StyleSheet, Image} from 'react-native' +import {Image, StyleSheet} from 'react-native' -import {ListRow, Detail, Title} from '@frogpond/lists' -import {Column, Row} from '@frogpond/layout' import {innerTextWithSpaces, parseHtml} from '@frogpond/html-lib' +import {Column, Row} from '@frogpond/layout' +import {Detail, ListRow, Title} from '@frogpond/lists' import {trackedOpenUrl} from '@frogpond/open-url' -import moment from 'moment' + import type {StreamType} from './types' +import moment from 'moment' const styles = StyleSheet.create({ image: { diff --git a/source/views/streaming/webcams/list.tsx b/source/views/streaming/webcams/list.tsx index 46c1f6318e..dfc78e9ae3 100644 --- a/source/views/streaming/webcams/list.tsx +++ b/source/views/streaming/webcams/list.tsx @@ -1,11 +1,14 @@ import * as React from 'react' -import {StyleSheet, ScrollView, useWindowDimensions} from 'react-native' +import {ScrollView, StyleSheet, useWindowDimensions} from 'react-native' + +import {RefreshControl} from 'react-native-gesture-handler' + import {Column} from '@frogpond/layout' +import {LoadingView, NoticeView} from '@frogpond/notice' + import {partitionByIndex} from '../../../lib/partition-by-index' -import {StreamThumbnail} from './thumbnail' import {useWebcams} from './query' -import {LoadingView, NoticeView} from '@frogpond/notice' -import {RefreshControl} from 'react-native-gesture-handler' +import {StreamThumbnail} from './thumbnail' export let WebcamsView = (): JSX.Element => { let viewport = useWindowDimensions() diff --git a/source/views/streaming/webcams/query.ts b/source/views/streaming/webcams/query.ts index 8dc347c158..99d9507fba 100644 --- a/source/views/streaming/webcams/query.ts +++ b/source/views/streaming/webcams/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' + import {Webcam} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { all: ['streaming', 'webcams'] as const, diff --git a/source/views/streaming/webcams/thumbnail.tsx b/source/views/streaming/webcams/thumbnail.tsx index d41b4b3856..a0795d576f 100644 --- a/source/views/streaming/webcams/thumbnail.tsx +++ b/source/views/streaming/webcams/thumbnail.tsx @@ -1,12 +1,13 @@ import * as React from 'react' -import {StyleSheet, View, Text, Image} from 'react-native' -import {Touchable} from '@frogpond/touchable' +import {Image, StyleSheet, Text, View} from 'react-native' + import * as c from '@frogpond/colors' -import {images as webcamImages} from '../../../../images/webcams' import {trackedOpenUrl} from '@frogpond/open-url' -import type {Webcam} from './types' +import {Touchable} from '@frogpond/touchable' import transparentPixel from '../../../../images/transparent.png' +import {images as webcamImages} from '../../../../images/webcams' +import type {Webcam} from './types' type Props = { webcam: Webcam diff --git a/source/views/student-orgs/detail-android.tsx b/source/views/student-orgs/detail-android.tsx index f95de46b9b..7f1181e7d7 100644 --- a/source/views/student-orgs/detail-android.tsx +++ b/source/views/student-orgs/detail-android.tsx @@ -1,14 +1,17 @@ import * as React from 'react' -import {ScrollView, Text, View, StyleSheet} from 'react-native' -import moment from 'moment' -import {Card} from '@frogpond/silly-card' +import {ScrollView, StyleSheet, Text, View} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' -import {sendEmail} from '../../components/send-email' import {openUrl} from '@frogpond/open-url' -import {showNameOrEmail} from './util' -import {RouteProp, useRoute} from '@react-navigation/native' +import {Card} from '@frogpond/silly-card' + +import {sendEmail} from '../../components/send-email' import {RootStackParamList} from '../../navigation/types' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' +import {showNameOrEmail} from './util' +import moment from 'moment' const styles = StyleSheet.create({ name: { diff --git a/source/views/student-orgs/detail-ios.tsx b/source/views/student-orgs/detail-ios.tsx index 88abb6eaa2..a6f5a0d417 100644 --- a/source/views/student-orgs/detail-ios.tsx +++ b/source/views/student-orgs/detail-ios.tsx @@ -1,16 +1,19 @@ import * as React from 'react' -import {ScrollView, Text, StyleSheet} from 'react-native' -import moment from 'moment' -import {Cell, Section, TableView} from '@frogpond/tableview' -import {SelectableCell} from '@frogpond/tableview/cells' +import {ScrollView, StyleSheet, Text} from 'react-native' + +import {RouteProp, useRoute} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import * as c from '@frogpond/colors' +import {decode} from '@frogpond/html-lib' import {openUrl} from '@frogpond/open-url' +import {Cell, Section, TableView} from '@frogpond/tableview' +import {SelectableCell} from '@frogpond/tableview/cells' + import {sendEmail} from '../../components/send-email' -import {showNameOrEmail} from './util' -import {decode} from '@frogpond/html-lib' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {RouteProp, useRoute} from '@react-navigation/native' import {RootStackParamList} from '../../navigation/types' +import {showNameOrEmail} from './util' +import moment from 'moment' const styles = StyleSheet.create({ name: { diff --git a/source/views/student-orgs/detail.ts b/source/views/student-orgs/detail.ts index b4a72f5217..a77511c804 100644 --- a/source/views/student-orgs/detail.ts +++ b/source/views/student-orgs/detail.ts @@ -1,13 +1,13 @@ import {Platform} from 'react-native' import { - View as IosDetail, - NavigationOptions as IosDetailNavigationOptions, -} from './detail-ios' -import { - View as AndroidDetail, NavigationOptions as AndroidDetailNavigationOptions, + View as AndroidDetail, } from './detail-android' +import { + NavigationOptions as IosDetailNavigationOptions, + View as IosDetail, +} from './detail-ios' const StudentOrgsDetailView = Platform.OS === 'ios' ? IosDetail : AndroidDetail diff --git a/source/views/student-orgs/index.ts b/source/views/student-orgs/index.ts index 7b62583492..97be13bdb2 100644 --- a/source/views/student-orgs/index.ts +++ b/source/views/student-orgs/index.ts @@ -1,5 +1,5 @@ -export {View as StudentOrgsView, NavigationOptions} from './list' export { - View as StudentOrgsDetailView, NavigationOptions as DetailNavigationOptions, + View as StudentOrgsDetailView, } from './detail' +export {NavigationOptions, View as StudentOrgsView} from './list' diff --git a/source/views/student-orgs/list.tsx b/source/views/student-orgs/list.tsx index 60f0f431b6..bda21385c4 100644 --- a/source/views/student-orgs/list.tsx +++ b/source/views/student-orgs/list.tsx @@ -1,28 +1,31 @@ import * as React from 'react' -import {StyleSheet, SectionList} from 'react-native' -import {NoticeView, LoadingView} from '@frogpond/notice' +import {SectionList, StyleSheet} from 'react-native' + +import {useNavigation} from '@react-navigation/native' +import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + +import * as c from '@frogpond/colors' import {Column} from '@frogpond/layout' import { + Detail, + emptyList, + largeListProps, ListRow, ListSectionHeader, ListSeparator, - Detail, Title, - largeListProps, - emptyList, } from '@frogpond/lists' -import * as c from '@frogpond/colors' -import groupBy from 'lodash/groupBy' -import toPairs from 'lodash/toPairs' -import words from 'lodash/words' -import deburr from 'lodash/deburr' -import type {StudentOrgType} from './types' +import {LoadingView, NoticeView} from '@frogpond/notice' import {useDebounce} from '@frogpond/use-debounce' -import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {useNavigation} from '@react-navigation/native' -import memoize from 'lodash/memoize' + import {ChangeTextEvent} from '../../navigation/types' import {useStudentOrgs} from './query' +import type {StudentOrgType} from './types' +import deburr from 'lodash/deburr' +import groupBy from 'lodash/groupBy' +import memoize from 'lodash/memoize' +import toPairs from 'lodash/toPairs' +import words from 'lodash/words' const splitToArray = memoize((str: string) => words(deburr(str.toLowerCase()))) diff --git a/source/views/student-orgs/query.ts b/source/views/student-orgs/query.ts index 0842a72f97..4916ef5770 100644 --- a/source/views/student-orgs/query.ts +++ b/source/views/student-orgs/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' + import {StudentOrgType} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { all: ['orgs'] as const, diff --git a/source/views/transportation/bus/components/bus-stop-row.tsx b/source/views/transportation/bus/components/bus-stop-row.tsx index c1ddf5dd44..31da23a35b 100644 --- a/source/views/transportation/bus/components/bus-stop-row.tsx +++ b/source/views/transportation/bus/components/bus-stop-row.tsx @@ -1,16 +1,18 @@ import * as React from 'react' import {ColorValue, Platform, StyleSheet} from 'react-native' + +import * as c from '@frogpond/colors' import {Column} from '@frogpond/layout' import {Detail, ListRow, Title} from '@frogpond/lists' -import type {BusTimetableEntry} from '../types' -import * as c from '@frogpond/colors' -import {ProgressChunk} from './progress-chunk' -import {ScheduleTimes} from './times' + import { BusStateEnum, findBusStopStatus as findStopStatus, findRemainingDeparturesForStop as findRemainingDepartures, } from '../lib' +import type {BusTimetableEntry} from '../types' +import {ProgressChunk} from './progress-chunk' +import {ScheduleTimes} from './times' import type {Moment} from 'moment' const styles = StyleSheet.create({ diff --git a/source/views/transportation/bus/components/progress-chunk.tsx b/source/views/transportation/bus/components/progress-chunk.tsx index eb0b061d1e..f6324028af 100644 --- a/source/views/transportation/bus/components/progress-chunk.tsx +++ b/source/views/transportation/bus/components/progress-chunk.tsx @@ -1,6 +1,8 @@ import * as React from 'react' -import * as c from '@frogpond/colors' import {ColorValue, Platform, StyleSheet, View} from 'react-native' + +import * as c from '@frogpond/colors' + import type {BusStopStatusEnum} from '../lib' const isAndroid = Platform.OS === 'android' diff --git a/source/views/transportation/bus/components/times.tsx b/source/views/transportation/bus/components/times.tsx index 411a092541..ece1ee3821 100644 --- a/source/views/transportation/bus/components/times.tsx +++ b/source/views/transportation/bus/components/times.tsx @@ -1,6 +1,6 @@ import * as React from 'react' - import {StyleProp, Text, TextStyle} from 'react-native' + import type {DepartureTimeList} from '../types' const TIME_FORMAT = 'h:mma' diff --git a/source/views/transportation/bus/lib/__tests__/find-bus-stop-status.test.ts b/source/views/transportation/bus/lib/__tests__/find-bus-stop-status.test.ts index 70b0672125..8545513aaa 100644 --- a/source/views/transportation/bus/lib/__tests__/find-bus-stop-status.test.ts +++ b/source/views/transportation/bus/lib/__tests__/find-bus-stop-status.test.ts @@ -1,13 +1,12 @@ -import {expect, test} from '@jest/globals' +import type {BusSchedule, UnprocessedBusSchedule} from '../../types' import {findBusStopStatus} from '../find-bus-stop-status' -import {getScheduleForNow} from '../get-schedule-for-now' import {getCurrentBusIteration} from '../get-current-bus-iteration' +import {getScheduleForNow} from '../get-schedule-for-now' import {processBusSchedule} from '../process-bus-line' import {dayAndTime} from './moment.helper' +import {expect, test} from '@jest/globals' import moment from 'moment' -import type {BusSchedule, UnprocessedBusSchedule} from '../../types' - function buildBusSchedules(now: moment.Moment): Array { // prettier-ignore let schedules: Array = [ diff --git a/source/views/transportation/bus/lib/__tests__/find-remaining-departures-for-stop.test.ts b/source/views/transportation/bus/lib/__tests__/find-remaining-departures-for-stop.test.ts index a1be68cf77..6302d19b07 100644 --- a/source/views/transportation/bus/lib/__tests__/find-remaining-departures-for-stop.test.ts +++ b/source/views/transportation/bus/lib/__tests__/find-remaining-departures-for-stop.test.ts @@ -1,10 +1,10 @@ -import {expect, test} from '@jest/globals' +import type {BusSchedule, UnprocessedBusSchedule} from '../../types' import {findRemainingDeparturesForStop} from '../find-remaining-departures-for-stop' -import {getScheduleForNow} from '../get-schedule-for-now' import {getCurrentBusIteration} from '../get-current-bus-iteration' +import {getScheduleForNow} from '../get-schedule-for-now' import {processBusSchedule} from '../process-bus-line' import {dayAndTime} from './moment.helper' -import type {BusSchedule, UnprocessedBusSchedule} from '../../types' +import {expect, test} from '@jest/globals' import moment from 'moment' function buildBusSchedules(now: moment.Moment): Array { diff --git a/source/views/transportation/bus/lib/__tests__/get-current-bus-iteration.test.ts b/source/views/transportation/bus/lib/__tests__/get-current-bus-iteration.test.ts index 4ecafec8cc..8c3e54904c 100644 --- a/source/views/transportation/bus/lib/__tests__/get-current-bus-iteration.test.ts +++ b/source/views/transportation/bus/lib/__tests__/get-current-bus-iteration.test.ts @@ -1,8 +1,8 @@ -import {expect, test} from '@jest/globals' +import type {BusSchedule, UnprocessedBusSchedule} from '../../types' import {getCurrentBusIteration} from '../get-current-bus-iteration' import {processBusSchedule} from '../process-bus-line' import {dayAndTime, time} from './moment.helper' -import type {BusSchedule, UnprocessedBusSchedule} from '../../types' +import {expect, test} from '@jest/globals' import moment from 'moment' function buildBusSchedules(now: moment.Moment): BusSchedule { diff --git a/source/views/transportation/bus/lib/__tests__/get-schedule-for-now.test.ts b/source/views/transportation/bus/lib/__tests__/get-schedule-for-now.test.ts index 4020b3e856..39082ccc74 100644 --- a/source/views/transportation/bus/lib/__tests__/get-schedule-for-now.test.ts +++ b/source/views/transportation/bus/lib/__tests__/get-schedule-for-now.test.ts @@ -1,8 +1,8 @@ -import {expect, test} from '@jest/globals' +import type {BusSchedule, UnprocessedBusSchedule} from '../../types' import {getScheduleForNow} from '../get-schedule-for-now' import {processBusSchedule} from '../process-bus-line' +import {expect, test} from '@jest/globals' import moment from 'moment' -import type {BusSchedule, UnprocessedBusSchedule} from '../../types' // prettier-ignore function buildBusSchedules(now: moment.Moment): Array { diff --git a/source/views/transportation/bus/lib/__tests__/parse-time.test.ts b/source/views/transportation/bus/lib/__tests__/parse-time.test.ts index 161537e16d..6c7cc6c0c0 100644 --- a/source/views/transportation/bus/lib/__tests__/parse-time.test.ts +++ b/source/views/transportation/bus/lib/__tests__/parse-time.test.ts @@ -1,5 +1,5 @@ -import {expect, it} from '@jest/globals' import {parseTime} from '../parse-time' +import {expect, it} from '@jest/globals' import moment from 'moment' it('returns `null` given `false`', () => { diff --git a/source/views/transportation/bus/lib/__tests__/process-bus-line.test.ts b/source/views/transportation/bus/lib/__tests__/process-bus-line.test.ts index fbe6d174a1..afb15a4dda 100644 --- a/source/views/transportation/bus/lib/__tests__/process-bus-line.test.ts +++ b/source/views/transportation/bus/lib/__tests__/process-bus-line.test.ts @@ -1,7 +1,7 @@ -import {expect, test} from '@jest/globals' +import {UnprocessedBusLine} from '../../types' import {processBusSchedule} from '../process-bus-line' import {time} from './moment.helper' -import {UnprocessedBusLine} from '../../types' +import {expect, test} from '@jest/globals' // prettier-ignore const line: UnprocessedBusLine = { diff --git a/source/views/transportation/bus/lib/find-bus-stop-status.ts b/source/views/transportation/bus/lib/find-bus-stop-status.ts index b8b791b6af..5bf48f505f 100644 --- a/source/views/transportation/bus/lib/find-bus-stop-status.ts +++ b/source/views/transportation/bus/lib/find-bus-stop-status.ts @@ -1,6 +1,6 @@ -import type {Moment} from 'moment' import type {BusTimetableEntry} from '../types' import type {BusStateEnum} from './get-current-bus-iteration' +import type {Moment} from 'moment' export type BusStopStatusEnum = 'at' | 'before' | 'after' | 'skip' diff --git a/source/views/transportation/bus/lib/get-current-bus-iteration.ts b/source/views/transportation/bus/lib/get-current-bus-iteration.ts index 5a7f9631b6..9f138fda1e 100644 --- a/source/views/transportation/bus/lib/get-current-bus-iteration.ts +++ b/source/views/transportation/bus/lib/get-current-bus-iteration.ts @@ -1,8 +1,8 @@ +import type {BusSchedule, DepartureTimeList} from '../types' import find from 'lodash/find' import findLast from 'lodash/findLast' import findLastIndex from 'lodash/findLastIndex' import type {Moment} from 'moment-timezone' -import type {BusSchedule, DepartureTimeList} from '../types' const isTruthy = (x: unknown) => Boolean(x) diff --git a/source/views/transportation/bus/lib/index.ts b/source/views/transportation/bus/lib/index.ts index 71601a7766..0aa0e9a773 100644 --- a/source/views/transportation/bus/lib/index.ts +++ b/source/views/transportation/bus/lib/index.ts @@ -1,9 +1,8 @@ +export type {BusStopStatusEnum} from './find-bus-stop-status' +export {findBusStopStatus} from './find-bus-stop-status' +export {findRemainingDeparturesForStop} from './find-remaining-departures-for-stop' +export type {BusStateEnum} from './get-current-bus-iteration' +export {getCurrentBusIteration} from './get-current-bus-iteration' export {getScheduleForNow} from './get-schedule-for-now' export {parseTime} from './parse-time' export {processBusLine} from './process-bus-line' -export {getCurrentBusIteration} from './get-current-bus-iteration' -export {findRemainingDeparturesForStop} from './find-remaining-departures-for-stop' -export {findBusStopStatus} from './find-bus-stop-status' - -export type {BusStateEnum} from './get-current-bus-iteration' -export type {BusStopStatusEnum} from './find-bus-stop-status' diff --git a/source/views/transportation/bus/lib/parse-time.ts b/source/views/transportation/bus/lib/parse-time.ts index 24d5147944..71d48a3021 100644 --- a/source/views/transportation/bus/lib/parse-time.ts +++ b/source/views/transportation/bus/lib/parse-time.ts @@ -1,7 +1,8 @@ -const TIME_FORMAT = 'h:mma' import {timezone} from '@frogpond/constants' -import moment from 'moment-timezone' + import type {Moment} from 'moment-timezone' +import moment from 'moment-timezone' +const TIME_FORMAT = 'h:mma' type MaybeTime = string | false diff --git a/source/views/transportation/bus/lib/process-bus-line.ts b/source/views/transportation/bus/lib/process-bus-line.ts index c9c23ae979..d3dafcc920 100644 --- a/source/views/transportation/bus/lib/process-bus-line.ts +++ b/source/views/transportation/bus/lib/process-bus-line.ts @@ -5,7 +5,6 @@ import type { UnprocessedBusSchedule, } from '../types' import {BusTimetableEntry} from '../types' - import {parseTime} from './parse-time' import type {Moment} from 'moment' diff --git a/source/views/transportation/bus/line.tsx b/source/views/transportation/bus/line.tsx index c5e35c563a..322a531b89 100644 --- a/source/views/transportation/bus/line.tsx +++ b/source/views/transportation/bus/line.tsx @@ -1,21 +1,23 @@ import * as React from 'react' import {useEffect, useState} from 'react' import {FlatList, Platform, StyleSheet, Text} from 'react-native' -import type {BusSchedule, UnprocessedBusLine} from './types' + +import * as c from '@frogpond/colors' +import {InfoHeader} from '@frogpond/info-header' +import {ListFooter, ListRow, ListSectionHeader} from '@frogpond/lists' +import {Separator} from '@frogpond/separator' + +import {BusStopRow} from './components/bus-stop-row' import { BusStateEnum, getCurrentBusIteration, getScheduleForNow, processBusLine, } from './lib' -import type {Moment} from 'moment-timezone' +import type {BusSchedule, UnprocessedBusLine} from './types' import find from 'lodash/find' import findLast from 'lodash/findLast' -import {Separator} from '@frogpond/separator' -import {BusStopRow} from './components/bus-stop-row' -import {ListFooter, ListRow, ListSectionHeader} from '@frogpond/lists' -import {InfoHeader} from '@frogpond/info-header' -import * as c from '@frogpond/colors' +import type {Moment} from 'moment-timezone' const styles = StyleSheet.create({ container: { diff --git a/source/views/transportation/bus/map.tsx b/source/views/transportation/bus/map.tsx index 5b6588c393..ffcbbf17a3 100644 --- a/source/views/transportation/bus/map.tsx +++ b/source/views/transportation/bus/map.tsx @@ -1,17 +1,20 @@ import * as React from 'react' // import {StyleSheet} from 'react-native' import {Text} from 'react-native' -import type {Moment} from 'moment' -import type {UnprocessedBusLine} from './types' + +import {RouteProp, useRoute} from '@react-navigation/native' + +import {timezone} from '@frogpond/constants' // import MapView from '@mapbox/react-native-mapbox-gl' import {NoticeView} from '@frogpond/notice' +import {useMomentTimer} from '@frogpond/timer' + +import {RootStackParamList} from '../../../navigation/types' import {getScheduleForNow, processBusLine} from './lib' +import type {UnprocessedBusLine} from './types' // import uniqBy from 'lodash/uniqBy' import isEqual from 'lodash/isEqual' -import {useMomentTimer} from '@frogpond/timer' -import {timezone} from '@frogpond/constants' -import {RouteProp, useRoute} from '@react-navigation/native' -import {RootStackParamList} from '../../../navigation/types' +import type {Moment} from 'moment' // const styles = StyleSheet.create({ // map: {...StyleSheet.absoluteFillObject}, diff --git a/source/views/transportation/bus/query.ts b/source/views/transportation/bus/query.ts index 3471e2fd82..2796f27419 100644 --- a/source/views/transportation/bus/query.ts +++ b/source/views/transportation/bus/query.ts @@ -1,6 +1,7 @@ import {client} from '@frogpond/api' -import {useQuery, UseQueryResult} from '@tanstack/react-query' + import {UnprocessedBusLine} from './types' +import {useQuery, UseQueryResult} from '@tanstack/react-query' export const keys = { all: ['transit', 'bus-routes'] as const, diff --git a/source/views/transportation/bus/types.ts b/source/views/transportation/bus/types.ts index ca7f066117..b2be98195a 100644 --- a/source/views/transportation/bus/types.ts +++ b/source/views/transportation/bus/types.ts @@ -1,6 +1,7 @@ -import type {Moment} from 'moment' import {ColorValue} from 'react-native' +import type {Moment} from 'moment' + export type DayOfWeek = 'Su' | 'Mo' | 'Tu' | 'We' | 'Th' | 'Fr' | 'Sa' export type Coordinates = [number, number] diff --git a/source/views/transportation/bus/wrapper.tsx b/source/views/transportation/bus/wrapper.tsx index ba272e1f1f..a68e30b53c 100644 --- a/source/views/transportation/bus/wrapper.tsx +++ b/source/views/transportation/bus/wrapper.tsx @@ -1,11 +1,14 @@ import * as React from 'react' -import {BusLine} from './line' -import {LoadingView, NoticeView} from '@frogpond/notice' -import {timezone} from '@frogpond/constants' + import {useNavigation} from '@react-navigation/native' -import {useBusRoutes} from './query' + +import {timezone} from '@frogpond/constants' +import {LoadingView, NoticeView} from '@frogpond/notice' import {useMomentTimer} from '@frogpond/timer' +import {BusLine} from './line' +import {useBusRoutes} from './query' + type Props = { line: string } diff --git a/source/views/transportation/index.tsx b/source/views/transportation/index.tsx index 7424598e01..1dad9a003f 100644 --- a/source/views/transportation/index.tsx +++ b/source/views/transportation/index.tsx @@ -1,15 +1,17 @@ import React from 'react' import {Platform} from 'react-native' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' + import { - MaterialIcon, - IosIcon, createTabNavigator, + IosIcon, + MaterialIcon, type Tab, } from '@frogpond/navigation-tabs' -import {OtherModesView} from './other-modes' import {BusView} from './bus' +import {OtherModesView} from './other-modes' type Params = { ExpressLineBusView: undefined diff --git a/source/views/transportation/other-modes/list.tsx b/source/views/transportation/other-modes/list.tsx index 85d176e4be..9347eb97ce 100644 --- a/source/views/transportation/other-modes/list.tsx +++ b/source/views/transportation/other-modes/list.tsx @@ -1,11 +1,13 @@ import * as React from 'react' -import {OtherModesRow} from './row' -import * as c from '@frogpond/colors' import {SectionList, StyleSheet} from 'react-native' + +import * as c from '@frogpond/colors' import {ListEmpty, ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {LoadingView, NoticeView} from '@frogpond/notice' import {openUrl} from '@frogpond/open-url' + import {useOtherModesGrouped} from './query' -import {LoadingView, NoticeView} from '@frogpond/notice' +import {OtherModesRow} from './row' const styles = StyleSheet.create({ listContainer: { diff --git a/source/views/transportation/other-modes/query.ts b/source/views/transportation/other-modes/query.ts index 4a89a7bf86..70d063f986 100644 --- a/source/views/transportation/other-modes/query.ts +++ b/source/views/transportation/other-modes/query.ts @@ -1,7 +1,8 @@ import {client} from '@frogpond/api' + +import {OtherModeType} from '../types' import {useQuery, UseQueryResult} from '@tanstack/react-query' import {groupBy, toPairs} from 'lodash' -import {OtherModeType} from '../types' export const keys = { all: ['transit', 'modes'] as const, diff --git a/source/views/transportation/other-modes/row.tsx b/source/views/transportation/other-modes/row.tsx index 090779f39c..1be346195a 100644 --- a/source/views/transportation/other-modes/row.tsx +++ b/source/views/transportation/other-modes/row.tsx @@ -1,7 +1,9 @@ import * as React from 'react' -import type {OtherModeType} from '../types' -import {Detail, ListRow, Title} from '@frogpond/lists' + import {Column, Row} from '@frogpond/layout' +import {Detail, ListRow, Title} from '@frogpond/lists' + +import type {OtherModeType} from '../types' type Props = { onPress: (mode: OtherModeType) => void diff --git a/source/views/views.ts b/source/views/views.ts index c61db28279..3a481096a9 100644 --- a/source/views/views.ts +++ b/source/views/views.ts @@ -1,11 +1,11 @@ import * as c from '@frogpond/colors' -import {RootViewsParamList} from '../navigation/types' +import {RootViewsParamList} from '../navigation/types' +import {NavigationKey as calendar} from './calendar' import {NavigationKey as menus} from './menus' +import {NavigationKey as news} from './news' import {NavigationKey as sis} from './sis' -import {NavigationKey as calendar} from './calendar' import {NavigationKey as streaming} from './streaming' -import {NavigationKey as news} from './news' import {NavigationKey as transportation} from './transportation' const hours: keyof RootViewsParamList = 'BuildingHours' From c9ca50e50371a0236eba2ed042acb15ce55b1851 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 18:03:01 -0600 Subject: [PATCH 6/8] use full import name for clarity --- .eslintrc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 194f5da6af..73bebcb28c 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -13,8 +13,8 @@ plugins: - 'eslint-plugin-react-native' - 'eslint-plugin-react-hooks' - '@tanstack/eslint-plugin-query' - - 'simple-import-sort' - - 'import' + - 'eslint-plugin-simple-import-sort' + - 'eslint-plugin-import' extends: - 'eslint:recommended' From 8b7aa0c18b7375da2c88ceb79d179287484fd2e5 Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 18:22:45 -0600 Subject: [PATCH 7/8] add grouping by image extensions --- .eslintrc.yaml | 2 ++ source/views/streaming/webcams/thumbnail.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 73bebcb28c..ee22af012e 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -158,4 +158,6 @@ rules: ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], # Style imports. ['^.+\\.s?css$'], + # Image imports. + ['\.(png|jpg)$'], ]] diff --git a/source/views/streaming/webcams/thumbnail.tsx b/source/views/streaming/webcams/thumbnail.tsx index a0795d576f..ead4137f01 100644 --- a/source/views/streaming/webcams/thumbnail.tsx +++ b/source/views/streaming/webcams/thumbnail.tsx @@ -6,6 +6,7 @@ import {trackedOpenUrl} from '@frogpond/open-url' import {Touchable} from '@frogpond/touchable' import transparentPixel from '../../../../images/transparent.png' + import {images as webcamImages} from '../../../../images/webcams' import type {Webcam} from './types' From 9c42fc1ec2c7c3c172c4523dd7e57efd0a2e7f5e Mon Sep 17 00:00:00 2001 From: Drew Volz Date: Sat, 21 Oct 2023 18:29:38 -0600 Subject: [PATCH 8/8] lint import sorting after merging latest --- .../__tests__/useCourseSearchRecentsScreen.test.tsx | 6 +++--- modules/app-config/index.ts | 3 ++- source/views/settings/index.ts | 8 ++++---- source/views/settings/screens/feature-flags.tsx | 11 ++++++----- source/views/views.ts | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/app-config/__tests__/useCourseSearchRecentsScreen.test.tsx b/modules/app-config/__tests__/useCourseSearchRecentsScreen.test.tsx index 4c5234f8bd..6b3fb055c6 100644 --- a/modules/app-config/__tests__/useCourseSearchRecentsScreen.test.tsx +++ b/modules/app-config/__tests__/useCourseSearchRecentsScreen.test.tsx @@ -1,10 +1,10 @@ import React, {ReactElement} from 'react' -import {describe, expect, test} from '@jest/globals' -import {renderHook, waitFor} from '@testing-library/react-native' -import {QueryClient, QueryClientProvider} from '@tanstack/react-query' import {useFeature} from '../index' import {AppConfigEntry} from '../types' +import {describe, expect, test} from '@jest/globals' +import {QueryClient, QueryClientProvider} from '@tanstack/react-query' +import {renderHook, waitFor} from '@testing-library/react-native' jest.mock('../../../modules/constants', () => ({ isDevMode: jest.fn(), diff --git a/modules/app-config/index.ts b/modules/app-config/index.ts index 29c08f034e..f038c578eb 100644 --- a/modules/app-config/index.ts +++ b/modules/app-config/index.ts @@ -1,7 +1,8 @@ +import {isDevMode} from '@frogpond/constants' + import {getFeatureFlag} from '../../source/lib/storage' import {AppConfigEntry, FeatureFlag} from './types' import {useQuery} from '@tanstack/react-query' -import {isDevMode} from '@frogpond/constants' export type {AppConfigEntry, FeatureFlag} from './types' diff --git a/source/views/settings/index.ts b/source/views/settings/index.ts index 3c8d24b4ac..936f891729 100644 --- a/source/views/settings/index.ts +++ b/source/views/settings/index.ts @@ -1,16 +1,16 @@ // General settings export {IconSettingsView} from './screens/change-icon' export {CreditsView} from './screens/credits' +export { + NavigationOptions as FeatureFlagNavigationOptions, + View as FeatureFlagView, +} from './screens/feature-flags' export {LegalView} from './screens/legal' export { NavigationOptions as SettingsNavigationOptions, View as SettingsView, } from './screens/overview' export {PrivacyView} from './screens/privacy' -export { - View as FeatureFlagView, - NavigationOptions as FeatureFlagNavigationOptions, -} from './screens/feature-flags' // Developer settings export {APITestNavigationOptions, APITestView} from './screens/api-test' diff --git a/source/views/settings/screens/feature-flags.tsx b/source/views/settings/screens/feature-flags.tsx index a8e5577f34..ad67443d2e 100644 --- a/source/views/settings/screens/feature-flags.tsx +++ b/source/views/settings/screens/feature-flags.tsx @@ -1,20 +1,21 @@ import * as React from 'react' -import {StyleSheet, Text, SectionList} from 'react-native' +import {SectionList, StyleSheet, Text} from 'react-native' import restart from 'react-native-restart' + import {NativeStackNavigationOptions} from '@react-navigation/native-stack' -import {CellToggle} from '@frogpond/tableview/cells' -import {ListEmpty, ListSectionHeader, ListSeparator} from '@frogpond/lists' +import {AppConfig, FeatureFlag} from '@frogpond/app-config' import * as c from '@frogpond/colors' +import {ListEmpty, ListSectionHeader, ListSeparator} from '@frogpond/lists' import {LoadingView, NoticeView} from '@frogpond/notice' +import {CellToggle} from '@frogpond/tableview/cells' import {toLaxTitleCase} from '@frogpond/titlecase' import {Touchable} from '@frogpond/touchable' -import {AppConfig, FeatureFlag} from '@frogpond/app-config' -import {groupBy, orderBy} from 'lodash' import {commonStyles} from '../../../../modules/navigation-buttons/styles' import * as storage from '../../../lib/storage' +import {groupBy, orderBy} from 'lodash' export const FeatureFlagsView = (): JSX.Element => { let [loading, setLoading] = React.useState(true) diff --git a/source/views/views.ts b/source/views/views.ts index c055f1d1fa..e959ae32b1 100644 --- a/source/views/views.ts +++ b/source/views/views.ts @@ -1,7 +1,7 @@ import {useCourseSearchRecentsScreen} from '@frogpond/app-config' import * as c from '@frogpond/colors' -import {MiscViewParamList,RootViewsParamList} from '../navigation/types' +import {MiscViewParamList, RootViewsParamList} from '../navigation/types' import {NavigationKey as calendar} from './calendar' import {NavigationKey as menus} from './menus' import {NavigationKey as news} from './news'