From acf13a40769bc5e851bbc75e62d969d3af47a031 Mon Sep 17 00:00:00 2001 From: ThatsMickey <28947074+miky41195@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:22:13 +0100 Subject: [PATCH] ci: enforce no eslint warnings * fix: fix eslint warning * feat(ui): added color for light theme * fix: fix eslint warning * chore: sync pod file * fix: eslint warning fix * fix: eslint warning fix * fix: eslint fix warning --- ios/Podfile.lock | 154 +++++++++--------- ios/students.xcodeproj/project.pbxproj | 14 +- lib/ui/components/Callout.tsx | 6 +- lib/ui/components/ModalContent.tsx | 13 +- lib/ui/components/PillButton.tsx | 4 +- lib/ui/components/RefreshControl.tsx | 2 +- lib/ui/components/Snackbar.tsx | 7 +- lib/ui/components/Stack.tsx | 2 +- lib/ui/components/calendar/Calendar.tsx | 45 +---- lib/ui/components/calendar/CalendarBody.tsx | 1 - lib/ui/types/Theme.ts | 1 + lib/ui/utils/calendar.ts | 2 +- package.json | 2 +- src/core/components/HtmlView.tsx | 5 +- src/core/components/TranslucentView.ios.tsx | 2 +- src/core/components/VideoControls.tsx | 2 +- src/core/hooks/messaging.ts | 4 +- src/core/hooks/useFullscreenUi.ts | 2 +- src/core/hooks/useGeolocation.ts | 4 +- src/core/hooks/useNotifications.ts | 25 +-- src/core/providers/PreferencesProvider.tsx | 2 +- src/core/themes/light.ts | 1 + src/features/agenda/screens/AgendaScreen.tsx | 51 +++--- .../agenda/screens/AgendaWeekScreen.tsx | 5 +- src/features/agenda/screens/BookingScreen.tsx | 9 +- .../bookings/components/BookingSlotModal.tsx | 2 +- .../hooks/useCalculateSeatsDimension.ts | 2 +- .../bookings/screens/BookingSlotScreen.tsx | 6 +- .../courses/screens/CourseDirectoryScreen.tsx | 2 +- .../screens/CourseIconPickerScreen.tsx | 2 +- src/features/guides/screens/GuideScreen.tsx | 2 +- .../places/hooks/useSearchPlaceToListItem.ts | 12 +- .../places/screens/EventPlacesScreen.tsx | 1 + .../places/screens/FreeRoomsScreen.tsx | 4 +- .../teaching/components/ExamListItem.tsx | 3 +- src/features/teaching/screens/ExamScreen.tsx | 10 +- .../tickets/screens/CreateTicketScreen.tsx | 2 +- .../tickets/screens/TicketFaqsScreen.tsx | 13 +- .../tickets/screens/TicketListScreen.tsx | 2 +- src/features/tickets/screens/TicketScreen.tsx | 2 +- .../components/ProvisionalGradeListItem.tsx | 10 +- .../transcript/screens/GradesScreen.tsx | 2 - .../screens/RecordedGradeScreen.tsx | 1 - 43 files changed, 197 insertions(+), 246 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9e782c8a..1e305bd7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1995,7 +1995,7 @@ PODS: - ReactCommon/turbomodule/core - Sentry/HybridSDK (= 8.36.0) - Yoga - - RNSVG (15.8.0): + - RNSVG (15.11.1): - React-Core - SDWebImage (5.11.1): - SDWebImage/Core (= 5.11.1) @@ -2355,94 +2355,94 @@ SPEC CHECKSUMS: MapboxMobileEvents: d044b9edbe0ec7df60f6c2c9634fe9a7f449266b nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 - RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648 + RCT-Folly: 84578c8756030547307e4572ab1947de1685c599 RCTDeprecation: fde92935b3caa6cb65cbff9fbb7d3a9867ffb259 RCTRequired: 75c6cee42d21c1530a6f204ba32ff57335d19007 RCTTypeSafety: 7e6fe47bfb693c50d4669db1a480ca5331795f5b React: 8e73704cdd5c7f801936776d2fc434c605a7827b React-callinvoker: fa27d1e091e683de88f576e6a5d4efc171929a4c - React-Core: 8dd14bffcc9b877091b698e45701160669a31f91 - React-CoreModules: b4437acf2ef25ce3689c84df661dc5d806559b35 - React-cxxreact: 6125cd820da7e18f9ca8343b3c42ee61634a4e0d + React-Core: 948deed7fa720eeb0d901ff9e45c3719767dab5f + React-CoreModules: a11ba75f64245d12a0869203664a802c11594c43 + React-cxxreact: a5ce05f8a0a1398958523f948fce00d4c8ce38ff React-debug: f474f5c202a277f76c81bf7cf26284f2c09880d7 - React-defaultsnativemodule: 05f1a83669c4f01b5761b58ca0968306c99f3d50 - React-domnativemodule: 64f3f5089cf214c31aa1821dd8fd4abc481baa91 - React-Fabric: ba9636cfc7f9b77df6cb7edb2c70d0237026404b - React-FabricComponents: c408da05a4ea5ba071732245b4a7f48f904e610a - React-FabricImage: c409858f319f11709b49ffa6c5bca4faf794cb44 + React-defaultsnativemodule: 6962ad056662f78298e498b186b4552f04159aa8 + React-domnativemodule: 9426536ea5f9f469ea18386104a123da41618b5e + React-Fabric: bbdcc01a98528846efacf0767567a8e76df794bb + React-FabricComponents: ab8967c5898d88f37486df0eb0111384c498d821 + React-FabricImage: 7a06db59488b37f509dee73fa0b2811608a67058 React-featureflags: 929732439d139ac0662e08f009f1a51ed2b91ed3 - React-featureflagsnativemodule: 2f899ad011b6b1a8aa8babe4fafa0a68725faeb6 - React-graphics: a5cad35307286e9f83e212834e95fef4010d03d0 - React-hermes: 14aafa9630579b84c2167b563bdb8c811970a03e - React-idlecallbacksnativemodule: ba1475765a2900e1adc76ce45a625ef5f79fdc19 - React-ImageManager: 41945afb3ace0c52255057ec4ae6af6f5a23539f - React-jserrorhandler: ecbc4622df7ab3d0066a4313cde4172d45745508 - React-jsi: ff383df87c7047e976a66be45df59e4e0db5346e - React-jsiexecutor: 2bb8b172f226f2f502521d33dd7666e701d45f45 - React-jsinspector: 4d51b903543f21076b658ef8412f3102778dbc92 - React-jsitracing: 654f4d9cb9fd99b3d96f239ceb215ae49ce28ac0 - React-logger: 97c9dafae1f1a638001a9d1d0e93d431f2f9cb7b - React-Mapbuffer: 3146a13424f9fec2ea1f1462d49d566e4d69b732 - React-microtasksnativemodule: 8fa0a3d8542f6ae7712deebe0802ee17a623718b - react-native-blob-util: 39a20f2ef11556d958dc4beb0aa07d1ef2690745 - react-native-blur: a1bf334589f44658a58a859b1f3defe28e367fcf - react-native-date-picker: 06a4d96ab525a163c7a90bccd68833d136b0bb13 - react-native-document-picker: 7343222102ece8aec51390717f47ad7119c7921f - react-native-geolocation: 0c7a8496962d3268ac5b28f22a8e5d7a04c43f1a - react-native-html-to-pdf: 4c5c6e26819fe202971061594058877aa9b25265 - react-native-menu: b7e42b26d3014c993db0f0ae3d5fcc523d5585bd - react-native-netinfo: f0a9899081c185db1de5bb2fdc1c88c202a059ac - react-native-override-color-scheme: 3badbbee9a4ea2a9c3e5b4a5d9fd9eaba8761870 - react-native-pager-view: c476f76d54f946df5147645e902d3d7173688187 - react-native-pdf-light: 60505ab2d7d5312154e9e4dc311c19c7540d2774 - react-native-render-html: 984dfe2294163d04bf5fe25d7c9f122e60e05ebe - react-native-safe-area-context: 4532f1a0c5d34a46b9324ccaaedcb5582a302b7d - react-native-video: 9aec95eecb1c523b67e71a44032935f77f926276 + React-featureflagsnativemodule: f43cb1106038209288cff1b6f40aa9efc52bdc06 + React-graphics: 6367275cc82d631c588a7146fd8dc69ec2f447e8 + React-hermes: b9bbe9c808d7ab1750ce089b243b03e4a099af63 + React-idlecallbacksnativemodule: 03cbc9e272530c6f0074d244648f4ad7a0a17066 + React-ImageManager: 5b001b9e974f5ba81f0645d3d799e2a20c61d91e + React-jserrorhandler: 35e5e5a5a99b7b36c3802a2d12ca86889ed5982a + React-jsi: d0d8c4019fd91d0cb4b432f2518e08dc37433a13 + React-jsiexecutor: 1cdaf24e36919d899250938f0f6c79ec1a256923 + React-jsinspector: 2fabeadbd0eb1cbd83a6fc2026fb38c75b200947 + React-jsitracing: 7c7c89c963893efd25e0d04c23e854b9a93e0b7e + React-logger: 7b5b458327a1ff0d7e5a349430d1ed133dcebaa3 + React-Mapbuffer: 0d88ad9afa9e195dd7634424bde1d38e4129e646 + React-microtasksnativemodule: 7198aff94d07184642b452007fe7166399fb47d6 + react-native-blob-util: f7234c91ad0e3faeee51b3edee80b61553f74993 + react-native-blur: 3d5dd1ed2dd810b304ac3bcee9cf7d460757c89b + react-native-date-picker: 585252087d4820b4cd8f2cf80068f6e8f5b72413 + react-native-document-picker: 530879d9e89b490f0954bcc4ab697c5b5e35d659 + react-native-geolocation: b485eb8776fea2dfa95a0f5469f2008fc40a56d4 + react-native-html-to-pdf: 7a49e6c58ac5221bcc093027b195f4b214f27a9d + react-native-menu: 6eb1bc1cffd6f3f29e0d33f0326552f805637b9c + react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187 + react-native-override-color-scheme: ffee175f44cafe12c6264aed171e6039b7c64bfe + react-native-pager-view: 8bd7d72d1c260ef565952ac617ab6e492c457894 + react-native-pdf-light: bf37b7f2ed2ac57493bbda9a85ed43d195866d2d + react-native-render-html: 5afc4751f1a98621b3009432ef84c47019dcb2bd + react-native-safe-area-context: b13be9714d9771fbde0120bc519c963484de3a71 + react-native-video: 591de66f98b3fc96491a79015fa6bb735ec65474 React-nativeconfig: 93fe8c85a8c40820c57814e30f3e44b94c995a7b - React-NativeModulesApple: b3e076fd0d7b73417fe1e8c8b26e3c57ae9b74aa - React-perflogger: 1c55bcd3c392137cbaf0d21d8bb87ce9a0cebb15 - React-performancetimeline: e89249db10b8f7bf8f72c2e9bd471ac37d48b753 + React-NativeModulesApple: a4457b73e63e983db66d66612160006bccb00ad5 + React-perflogger: 3140b7778984a486db80d4d2aeaa266cae4eb8c7 + React-performancetimeline: 41c100bc1299d7b150821b99cf26661c51ed9ab0 React-RCTActionSheet: 9407c795fbeee35da2dae3cd6b5c4e5da6ff8bd3 - React-RCTAnimation: 7ee1c2a77aab7e5c568611d8092a994cfcbe8410 - React-RCTAppDelegate: e7b835203804bfd12a8baad30ab4c67f7da7bf24 - React-RCTBlob: 761072706300d22624ec2d6bf860b77d95ebd3da - React-RCTFabric: a6c44c606009f889ef7431e71f03c5339fb72e6e - React-RCTImage: b6614fde902ec9647f15236da94df2d24c40523f - React-RCTLinking: 25950eda5d5f786bfb3daf513ea7d848555a2a93 - React-RCTNetwork: b69407c4119fd7a1cc07db4a94563f2546f8770d - React-RCTSettings: b310a4923446c3a8950fa866c8cf83323a9e1b87 - React-RCTText: 77c6eda5be1dee657f5183f75fe0fdcdb7b2b35d - React-RCTVibration: b4889c7702aea1b07316be1ec0de2e36e9a4d077 + React-RCTAnimation: 48e5c6b541fd4c7a96c333e61974c3de34bbe849 + React-RCTAppDelegate: e7c9ec6b2728e0335c8bd086f05de81529b54645 + React-RCTBlob: f67be4e0fbe51db1574aec402754054ab9c39668 + React-RCTFabric: 3cf48f54567f00835ffa1fc687dfde2f3b1f190c + React-RCTImage: 57894a0e42502461d87449bec6cb0f124a49a93b + React-RCTLinking: abd71677bc3353327bec26b0ccd0a0c3960efa1c + React-RCTNetwork: 2e91efa49b63e54a9782922e5ca1d09ff2789341 + React-RCTSettings: fd13eebaa3f9af0b56a0ecb053b108e160fbfe07 + React-RCTText: 4cd7c87db1e1da51a96b86ce39c5468c1dbaae60 + React-RCTVibration: 579f64ceb06701eca3004a500169e1152c1ef7d2 React-rendererconsistency: 5ef1c4642fd6365bf6d5d4e29a3ae02c3a1b8980 - React-rendererdebug: 7f6a24cbb5008a22ccb34a0d031a259b006facf6 + React-rendererdebug: 8952e1ad914c680d4978916a9eed7c6dc85301d7 React-rncore: 0e5394ce20a9d2bf12409d14395588c7b9e6e9ce - React-RuntimeApple: bbe293f233d17304c9597309acde7505080fd53d - React-RuntimeCore: 5a1cbfc3e7af4fbdea2b9b1efd39cd51a4d4006f + React-RuntimeApple: f5ed38fba1230713313e88e750dcad06948ba625 + React-RuntimeCore: 0fc488daf136f05d96349772828ccf64f66d6d2a React-runtimeexecutor: ffac5f09795a5e881477e0d72a0fa6385456bed3 - React-RuntimeHermes: 0a1fd1c150faed8341887dd89895eeb8d4d2d3c5 - React-runtimescheduler: e7df538274de0c65736068e40efc0d2228f42d0d + React-RuntimeHermes: b8f395d41116c3bdf3373e87c39a856f69c3fff8 + React-runtimescheduler: 933c72afd4f285b2bb473c0de2482ee250f3e735 React-timing: b3b233fe819d9e5b6ca32b605aa732621bdfa5aa - React-utils: 5362bd16a9563f9916e7a56c011ddc533507650f - ReactCodegen: 865bafc5c17ec2181620ced1a32c39c38ab2951d - ReactCommon: 422e364463f33e336fc4db196aeb50fd801d90d6 - RNCAsyncStorage: d35c79ffba52c1013013e16b1fc295aec2feabb6 - RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb - RNDeviceInfo: 29e01d5ae94bdb5a0f6c11a4c438132545b4df80 - RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8 - RNFBApp: 5d3d1b9d563857c68d161a3226d9dd6d6be1a846 - RNFBMessaging: 2895d9dfa1cfea663c26a1b5dfb5faf17ad096f8 - RNFileViewer: ce7ca3ac370e18554d35d6355cffd7c30437c592 - RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 - RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8 - RNImageCropPicker: 771e2ca319d2cf92e04ebf334ece892ee9a6728f - RNKeychain: bfe3d12bf4620fe488771c414530bf16e88f3678 - RNLocalize: 298e85ce16540a11de40c1a588ead39fc5e9a072 - rnmapbox-maps: 334654168efcdc29584a9af1519d890a07a4a28e - RNPermissions: 107a3106f541d738b80450cdf2dd9fbd134646eb - RNReanimated: 3e6072b3d49d4fc687b8f1ba3022f0fdc0b43969 - RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958 - RNSentry: 20fff14a1beee1313d8c3631c54d3e6cced73410 - RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d + React-utils: 0c825829a8e2ca39bb049d95f270a2dbf39ecb05 + ReactCodegen: 3b0ff1c9015e3ebcf2bd2f8559995c74bfacf8a1 + ReactCommon: c21a3d6a8d3e98b6e99730139a52f59f0beea89d + RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97 + RNCClipboard: 7c3e3b5f71d84ef61690ad377b6c50cf27864ff5 + RNDeviceInfo: ae26ae45db3f9937f038a284bcd0a1db8d70db96 + RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87 + RNFBApp: 598b2df8ff9014bdd6ebc33a531947629196d576 + RNFBMessaging: 3323183f2b06939d4abd4dd76299b2b08dae453c + RNFileViewer: 4b5d83358214347e4ab2d4ca8d5c1c90d869e251 + RNFS: 89de7d7f4c0f6bafa05343c578f61118c8282ed8 + RNGestureHandler: 27a63f2218affdf1a426d56682f9b174904838b3 + RNImageCropPicker: d14a08134d1b5bc2d5f29a12ce3ac1d402dd2389 + RNKeychain: bbe2f6d5cc008920324acb49ef86ccc03d3b38e4 + RNLocalize: d024afa9204c13885e61dc88b8190651bcaabac9 + rnmapbox-maps: 42fe0ccc373fe24032aa224736feb4c39a24d604 + RNPermissions: 95f7574e1ef4bb4c4d9f6a9a8125d0ae809bd052 + RNReanimated: 3b207674fbe474b0b5a408c5cbdfd8a3eec1439d + RNScreens: 35bb8e81aeccf111baa0ea01a54231390dbbcfd9 + RNSentry: 066541f7e9a39ca16b42df38a7f274063524bfb9 + RNSVG: 86fecdfc637614ba9def63f7f3f2e7795e018356 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 @@ -2453,4 +2453,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e87b6939d36becad7b6420c245dee47d379df497 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/ios/students.xcodeproj/project.pbxproj b/ios/students.xcodeproj/project.pbxproj index 613d200b..f90ca01e 100644 --- a/ios/students.xcodeproj/project.pbxproj +++ b/ios/students.xcodeproj/project.pbxproj @@ -88,7 +88,7 @@ 96125A242AD6B04500CF037A /* students.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = students.entitlements; path = students/students.entitlements; sourceTree = ""; }; ACC8FDE515D5BD1D8D01BAF8 /* libPods-students-students dev.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-students-students dev.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B44D6C2229F17BF2001BA0DC /* students dev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "students dev.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - B44D6C2329F17BF2001BA0DC /* students/DevInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = students/DevInfo.plist; sourceTree = ""; }; + B44D6C2329F17BF2001BA0DC /* DevInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = students/DevInfo.plist; sourceTree = ""; }; B7D759302BF2478B00178B49 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; B813406DDE44447AB8717E6E /* Montserrat-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Montserrat-SemiBold.ttf"; path = "../assets/fonts/Montserrat/Montserrat-SemiBold.ttf"; sourceTree = ""; }; BADEE9E139127DB51296F263 /* libPods-students-studentsTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-students-studentsTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -151,7 +151,7 @@ isa = PBXGroup; children = ( 96125A242AD6B04500CF037A /* students.entitlements */, - B44D6C2329F17BF2001BA0DC /* students/DevInfo.plist */, + B44D6C2329F17BF2001BA0DC /* DevInfo.plist */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 13B07FB51A68108700A75B9A /* Images.xcassets */, @@ -911,7 +911,10 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); PRODUCT_NAME = "PoliTO Students"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; @@ -988,7 +991,10 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); PRODUCT_NAME = "PoliTO Students"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; diff --git a/lib/ui/components/Callout.tsx b/lib/ui/components/Callout.tsx index bfa246f0..46ac9662 100644 --- a/lib/ui/components/Callout.tsx +++ b/lib/ui/components/Callout.tsx @@ -27,11 +27,11 @@ const createStyles = ({ colors, shapes }: Theme) => container: { maxWidth: 300, maxHeight: 200, - backgroundColor: 'white', + backgroundColor: colors.white, borderRadius: shapes.md, borderColor: colors.divider, borderWidth: 1, - shadowColor: 'black', + shadowColor: colors.black, shadowOpacity: 0.3, shadowRadius: 8, shadowOffset: { @@ -46,7 +46,7 @@ const createStyles = ({ colors, shapes }: Theme) => bottom: -6, width: 10, height: 10, - backgroundColor: 'white', + backgroundColor: colors.white, borderColor: colors.divider, borderRightWidth: 1, borderBottomWidth: 1, diff --git a/lib/ui/components/ModalContent.tsx b/lib/ui/components/ModalContent.tsx index c9808082..b93945aa 100644 --- a/lib/ui/components/ModalContent.tsx +++ b/lib/ui/components/ModalContent.tsx @@ -26,11 +26,14 @@ export const ModalContent = ({ const styles = useStylesheet(createStyles); const { t } = useTranslation(); - const handleOnScroll = useCallback((event: any) => { - if (setScrollOffset) { - setScrollOffset(event.nativeEvent.contentOffset.y); - } - }, []); + const handleOnScroll = useCallback( + (event: any) => { + if (setScrollOffset) { + setScrollOffset(event.nativeEvent.contentOffset.y); + } + }, + [setScrollOffset], + ); return ( diff --git a/lib/ui/components/PillButton.tsx b/lib/ui/components/PillButton.tsx index d9c175a3..4dcd90c2 100644 --- a/lib/ui/components/PillButton.tsx +++ b/lib/ui/components/PillButton.tsx @@ -48,7 +48,7 @@ export const PillButton = ({ ); }; -const createStyles = ({ palettes, spacing, fontWeights }: Theme) => +const createStyles = ({ palettes, spacing, fontWeights, colors }: Theme) => StyleSheet.create({ container: { borderRadius: 10, @@ -67,6 +67,6 @@ const createStyles = ({ palettes, spacing, fontWeights }: Theme) => }, textNeutral: {}, textPrimary: { - color: 'white', + color: colors.white, }, }); diff --git a/lib/ui/components/RefreshControl.tsx b/lib/ui/components/RefreshControl.tsx index 1409b244..77cf1a26 100644 --- a/lib/ui/components/RefreshControl.tsx +++ b/lib/ui/components/RefreshControl.tsx @@ -54,7 +54,7 @@ export const RefreshControl = ({ queries, manual = false, ...rest }: Props) => { AccessibilityInfo.announceForAccessibility(t('common.endRefresh')); } } - }, [refreshing, screenReaderEnabled]); + }, [refreshing, screenReaderEnabled, previousRefreshing, t]); const onRefresh = useCallback(() => { if (!onlineManager.isOnline()) return; diff --git a/lib/ui/components/Snackbar.tsx b/lib/ui/components/Snackbar.tsx index 877f510d..20e6992e 100644 --- a/lib/ui/components/Snackbar.tsx +++ b/lib/ui/components/Snackbar.tsx @@ -39,7 +39,6 @@ const ANIMATION_TIME = 300; // .3 seconds export const Snackbar = ({ visible, isPersistent = false, - isError = false, action, onDismiss, text, @@ -64,11 +63,7 @@ export const Snackbar = ({ useEffect(() => { if (isEnabled && visible) announce(text); - }, [isEnabled, announce, visible]); - - // useEffect(() => { - // if() - // }, [text]); + }, [isEnabled, announce, visible, text]); const handleOnVisible = useLatestCallback(() => { // show diff --git a/lib/ui/components/Stack.tsx b/lib/ui/components/Stack.tsx index d478a3ed..dc4189cb 100644 --- a/lib/ui/components/Stack.tsx +++ b/lib/ui/components/Stack.tsx @@ -75,7 +75,7 @@ export type StackProps< */ gap?: keyof Theme['spacing']; } & Partial<{ - [key in keyof typeof spacingShorthands]: keyof Theme['spacing']; + [_key in keyof typeof spacingShorthands]: keyof Theme['spacing']; }> & ComponentProps; diff --git a/lib/ui/components/calendar/Calendar.tsx b/lib/ui/components/calendar/Calendar.tsx index 9d8fd384..94db92ce 100644 --- a/lib/ui/components/calendar/Calendar.tsx +++ b/lib/ui/components/calendar/Calendar.tsx @@ -110,7 +110,6 @@ export const Calendar = ({ dayHeaderStyle = {}, dayHeaderHighlightColor = '', weekDayHeaderHighlightColor = '', - bodyContainerStyle = {}, swipeEnabled = true, weekStartsOn = 0, onChangeDate, @@ -119,15 +118,11 @@ export const Calendar = ({ onPressEvent, renderEvent, renderHeader: HeaderComponent = CalendarHeader, - // renderHeaderForMonthView : HeaderComponentForMonthView = CalendarHeaderForMonthView, weekEndsOn = 6, activeDate, headerComponent = null, headerComponentStyle = {}, showAllDayEventCell = true, - moreLabel = '{moreCount} More', - showAdjacentMonths = true, - sortedMonthView = true, isEventOrderingEnabled, hours, startHour = 6, @@ -215,45 +210,7 @@ export const Calendar = ({ }; // TODO restore month view - // if (mode === 'month') { - // const headerProps = { - // style: headerContainerStyle, - // locale: locale, - // weekStartsOn: weekStartsOn, - // headerContentStyle: headerContentStyle, - // dayHeaderStyle: dayHeaderStyle, - // dayHeaderHighlightColor: dayHeaderHighlightColor, - // weekDayHeaderHighlightColor: weekDayHeaderHighlightColor, - // showAllDayEventCell: showAllDayEventCell, - // }; - // return ( - // - // {/**/} - // - // {...commonProps} - // style={bodyContainerStyle} - // containerHeight={height} - // events={[...daytimeEvents, ...allDayEvents]} - // eventCellStyle={eventCellStyle} - // calendarCellStyle={calendarCellStyle} - // calendarCellTextStyle={calendarCellTextStyle} - // weekStartsOn={weekStartsOn} - // hideNowIndicator={hideNowIndicator} - // showAdjacentMonths={showAdjacentMonths} - // onPressCell={onPressCell} - // onPressDateHeader={onPressDateHeader} - // onPressEvent={onPressEvent} - // onSwipeHorizontal={onSwipeHorizontal} - // renderEvent={renderEvent} - // targetDate={targetDate} - // maxVisibleEventCount={maxVisibleEventCount} - // eventMinHeightForMonthView={eventMinHeightForMonthView} - // sortedMonthView={sortedMonthView} - // moreLabel={moreLabel} - // /> - // - // ); - // } + // https://github.com/polito/students-app/blob/v1.6.9/lib/ui/components/calendar/Calendar.tsx#L217 const headerProps = { ...commonProps, diff --git a/lib/ui/components/calendar/CalendarBody.tsx b/lib/ui/components/calendar/CalendarBody.tsx index 6a5e2d48..ecd518c9 100644 --- a/lib/ui/components/calendar/CalendarBody.tsx +++ b/lib/ui/components/calendar/CalendarBody.tsx @@ -80,7 +80,6 @@ export const CalendarBody = ({ headerComponent = null, headerComponentStyle = {}, hideHours = false, - isEventOrderingEnabled = true, hours = HOURS, startHour = 8, }: CalendarBodyProps) => { diff --git a/lib/ui/types/Theme.ts b/lib/ui/types/Theme.ts index 38d4df44..1b01642b 100644 --- a/lib/ui/types/Theme.ts +++ b/lib/ui/types/Theme.ts @@ -101,6 +101,7 @@ export interface Colors { errorCardBorder: string; translucentSurface: string; white: string; + yellow: string; black: string; } diff --git a/lib/ui/utils/calendar.ts b/lib/ui/utils/calendar.ts index 5c2bce4e..643ec019 100644 --- a/lib/ui/utils/calendar.ts +++ b/lib/ui/utils/calendar.ts @@ -332,7 +332,7 @@ export function getStyledEvents( } let left: number, b0: number, b1: number; - const finalEvents = newEvents.map(({ day, cells, num, r0, r1, ...rest }) => { + const finalEvents = newEvents.map(({ day, cells, num, ...rest }) => { const B = lcm(nums[day] ?? 1); const a0 = cells[0]; const a1 = cells[cells.length - 1] + 1; diff --git a/package.json b/package.json index db912f85..caaed66e 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "jest", "prepare": "husky", "commit": "commit", - "lint:check": "eslint '**/*.{ts,tsx}'", + "lint:check": "eslint --max-warnings=0 '**/*.{ts,tsx}'", "lint": "npm run lint:check -- --fix", "format:check": "prettier --check '**/*.{ts,tsx,md}'", "format": "prettier --write '**/*.{ts,tsx,md}'", diff --git a/src/core/components/HtmlView.tsx b/src/core/components/HtmlView.tsx index 60f457c7..ea687524 100644 --- a/src/core/components/HtmlView.tsx +++ b/src/core/components/HtmlView.tsx @@ -1,3 +1,4 @@ +import { memo } from 'react'; import { StyleSheet, useWindowDimensions } from 'react-native'; import RenderHTML, { RenderHTMLProps } from 'react-native-render-html'; @@ -5,7 +6,7 @@ import { useStylesheet } from '@lib/ui/hooks/useStylesheet'; import { useTheme } from '@lib/ui/hooks/useTheme'; import { Theme } from '@lib/ui/types/Theme'; -export const HtmlView = (props: RenderHTMLProps) => { +export const HtmlView = memo((props: RenderHTMLProps) => { const { colors, palettes, spacing, fontSizes } = useTheme(); const { width } = useWindowDimensions(); const styles = useStylesheet(createStyles); @@ -39,7 +40,7 @@ export const HtmlView = (props: RenderHTMLProps) => { ]} /> ); -}; +}); const createStyles = ({ spacing, fontWeights }: Theme) => StyleSheet.create({ diff --git a/src/core/components/TranslucentView.ios.tsx b/src/core/components/TranslucentView.ios.tsx index 4864f7d0..f3061f40 100644 --- a/src/core/components/TranslucentView.ios.tsx +++ b/src/core/components/TranslucentView.ios.tsx @@ -17,7 +17,7 @@ export const TranslucentView = ({ blurType: dark ? 'ultraThinMaterialDark' : 'ultraThinMaterialLight', reducedTransparencyFallbackColor: colors.surface, }), - [dark], + [dark, colors.surface], ); return ( diff --git a/src/core/components/VideoControls.tsx b/src/core/components/VideoControls.tsx index da89122e..5d80163e 100644 --- a/src/core/components/VideoControls.tsx +++ b/src/core/components/VideoControls.tsx @@ -117,7 +117,7 @@ export const VideoControls = ({ } opacityAnimation.current = null; }); - }, [controlsHidden]); + }, [controlsHidden, paused, buffering, sliding, controlsOpacity]); useEffect(() => { if ((paused || buffering || sliding) && hideTimeout.current) { diff --git a/src/core/hooks/messaging.ts b/src/core/hooks/messaging.ts index f351a506..9cbe62d5 100644 --- a/src/core/hooks/messaging.ts +++ b/src/core/hooks/messaging.ts @@ -54,11 +54,11 @@ export const useInitFirebaseMessaging = () => { navigateToUpdate(remoteMessage as RemoteMessage); }); - const unsubscribeOnMessage = messaging().onMessage(remoteMessage => + const unsubscribeOnMessage = messaging().onMessage(() => queryClient.invalidateQueries(NOTIFICATIONS_QUERY_KEY), ); - messaging().setBackgroundMessageHandler(async remoteMessage => { + messaging().setBackgroundMessageHandler(async () => { queryClient.invalidateQueries(NOTIFICATIONS_QUERY_KEY); }); diff --git a/src/core/hooks/useFullscreenUi.ts b/src/core/hooks/useFullscreenUi.ts index d735217e..f874d8fa 100644 --- a/src/core/hooks/useFullscreenUi.ts +++ b/src/core/hooks/useFullscreenUi.ts @@ -25,5 +25,5 @@ export const useFullscreenUi = (fullscreen: boolean) => { navigation.setOptions({ headerShown: true }); displayTabBar(navRoot); }; - }, [fullscreen]); + }, [fullscreen, navigation]); }; diff --git a/src/core/hooks/useGeolocation.ts b/src/core/hooks/useGeolocation.ts index 441ec384..7b0cb83d 100644 --- a/src/core/hooks/useGeolocation.ts +++ b/src/core/hooks/useGeolocation.ts @@ -61,7 +61,7 @@ export const useGeolocation = () => { }, ); }); - }, [t]); + }, [t, setFeedback]); useEffect(() => { Geolocation.requestAuthorization( @@ -79,7 +79,7 @@ export const useGeolocation = () => { } }, ); - }, [t]); + }, [t, setFeedback]); return { getCurrentPosition, diff --git a/src/core/hooks/useNotifications.ts b/src/core/hooks/useNotifications.ts index aa97bd7f..2e2a008a 100644 --- a/src/core/hooks/useNotifications.ts +++ b/src/core/hooks/useNotifications.ts @@ -21,14 +21,6 @@ import { UnreadNotificationsByScope, } from '../types/notifications'; -type PathExtractor = T extends Array - ? never - : T extends object - ? { - [K in keyof T]: PathExtractor; - }[keyof T] - : Paths; - type CourseTransactionId = | 'avvisidoc' | 'videolezioni' @@ -50,14 +42,14 @@ type TransactionId = | 'booking' | 'avvisi'; -const messageTransactionIds: MessageTransactionId[] = [ - 'emergenze', - 'eventi', - 'esitiesami', - 'individuale', - 'messaggidoc', - 'segreteria', -]; +// const messageTransactionIds: MessageTransactionId[] = [ +// 'emergenze', +// 'eventi', +// 'esitiesami', +// 'individuale', +// 'messaggidoc', +// 'segreteria', +// ]; const courseTransactionsMapping: Record< CourseTransactionId, @@ -143,6 +135,7 @@ export const useNotifications = () => { summarize = false, ) => { // TODO PathExtractor + // https://github.com/polito/students-app/blob/v1.6.9/src/core/hooks/useNotifications.ts#L24 const root = get(unreadNotifications, path!); const visitNode = (node: object | Notification[]): number => { if (Array.isArray(node)) { diff --git a/src/core/providers/PreferencesProvider.tsx b/src/core/providers/PreferencesProvider.tsx index 6178afd7..86b1b4f4 100644 --- a/src/core/providers/PreferencesProvider.tsx +++ b/src/core/providers/PreferencesProvider.tsx @@ -94,7 +94,7 @@ export const PreferencesProvider = ({ children }: PropsWithChildren) => { return { ...oldP, ...preferences }; }); }); - }, []); + }, [deviceLanguage]); // Preferences are loaded useEffect(() => { diff --git a/src/core/themes/light.ts b/src/core/themes/light.ts index 21be2a2b..82779e6a 100644 --- a/src/core/themes/light.ts +++ b/src/core/themes/light.ts @@ -146,6 +146,7 @@ export const lightTheme: Theme = { surfaceDark: navy[700], white: '#FFFFFF', black: '#000000', + yellow: '#FFD700', headersBackground: IS_ANDROID ? '#FFFFFF' : '#EDEEF0', heading: navy[700], subHeading: lightBlue[700], diff --git a/src/features/agenda/screens/AgendaScreen.tsx b/src/features/agenda/screens/AgendaScreen.tsx index ffd28c23..4069be26 100644 --- a/src/features/agenda/screens/AgendaScreen.tsx +++ b/src/features/agenda/screens/AgendaScreen.tsx @@ -80,8 +80,6 @@ export const AgendaScreen = ({ navigation, route }: Props) => { const flatListRef = useRef>(null); - const prevPageThreshold = 300; - const isOffline = useOfflineDisabled(); const [agendaState, setAgendaState, agendaStateRef] = @@ -127,21 +125,24 @@ export const AgendaScreen = ({ navigation, route }: Props) => { return; setNextDate(startDate); }, - [], + [nextDateRef, setNextDate], ); - const getSelectedWeek = useCallback((newJSDate: Date) => { - setDataPickerIsOpened(false); - const newDate = DateTime.fromJSDate(newJSDate, { - zone: IANAZone.create('Europe/Rome'), - }); - ( - navigation as NativeStackNavigationProp - ).replace('Agenda', { - date: newDate, - animated: false, - }); - }, []); + const getSelectedWeek = useCallback( + (newJSDate: Date) => { + setDataPickerIsOpened(false); + const newDate = DateTime.fromJSDate(newJSDate, { + zone: IANAZone.create('Europe/Rome'), + }); + ( + navigation as NativeStackNavigationProp + ).replace('Agenda', { + date: newDate, + animated: false, + }); + }, + [navigation], + ); const scrollToSelectedDay = useCallback(() => { agendaStateRef.current.dayOffsetOverall > 0 && @@ -152,20 +153,8 @@ export const AgendaScreen = ({ navigation, route }: Props) => { setIsScrolling(false); }, [agendaStateRef]); - const scrollToLastOffset = () => { - flatListRef.current?.scrollToOffset({ - offset: agendaState.currentOffset, - animated: false, - }); - }; - - const onContentHeightChange = (height: number) => { - setAgendaState(prev => ({ - ...prev, - contentHeight: height, - todayOffsetOverall: prev.dayOffsetOverall + (height - prev.contentHeight), - })); - }; + // TODO try to scroll backwards + // https://github.com/polito/students-app/blob/v1.6.9/src/features/agenda/screens/AgendaScreen.tsx#L155 const screenOptions = useMemo( () => [ @@ -178,14 +167,14 @@ export const AgendaScreen = ({ navigation, route }: Props) => { title: t('agendaScreen.weeklyLayout'), }, ], - [], + [t], ); useEffect(() => { if (isScrolling) { scrollToSelectedDay(); } - }, [isScrolling]); + }, [isScrolling, scrollToSelectedDay]); useLayoutEffect(() => { const switchToWeekly = () => { diff --git a/src/features/agenda/screens/AgendaWeekScreen.tsx b/src/features/agenda/screens/AgendaWeekScreen.tsx index 515129a7..c2861bcb 100644 --- a/src/features/agenda/screens/AgendaWeekScreen.tsx +++ b/src/features/agenda/screens/AgendaWeekScreen.tsx @@ -132,7 +132,7 @@ export const AgendaWeekScreen = ({ navigation, route }: Props) => { title: t('agendaScreen.dailyLayout'), }, ], - [], + [t], ); useLayoutEffect(() => { @@ -188,6 +188,9 @@ export const AgendaWeekScreen = ({ navigation, route }: Props) => { t, agendaScreen, selectedDate, + refetch, + screenOptions, + updatePreference, ]); const isPrevMissing = useCallback( diff --git a/src/features/agenda/screens/BookingScreen.tsx b/src/features/agenda/screens/BookingScreen.tsx index 3e8cb1a3..54fca4ce 100644 --- a/src/features/agenda/screens/BookingScreen.tsx +++ b/src/features/agenda/screens/BookingScreen.tsx @@ -89,7 +89,14 @@ export const BookingScreen = ({ navigation, route }: Props) => { headerTitle: title, }); } - }, [bookingsQuery, titleStyles.headerStyle, width, description, title]); + }, [ + bookingsQuery, + titleStyles.headerStyle, + width, + description, + title, + navigation, + ]); const hasCheckIn = useMemo( () => diff --git a/src/features/bookings/components/BookingSlotModal.tsx b/src/features/bookings/components/BookingSlotModal.tsx index 4367c762..c6c17459 100644 --- a/src/features/bookings/components/BookingSlotModal.tsx +++ b/src/features/bookings/components/BookingSlotModal.tsx @@ -89,7 +89,7 @@ export const BookingSlotModal = ({ close, item }: Props) => { const message = findAccessibilityMessage(); if (!message) return; setTimeoutAccessibilityInfoHelper(message, 500); - }, []); + }, [findAccessibilityMessage]); const NotBookableMessage = () => { if ( diff --git a/src/features/bookings/hooks/useCalculateSeatsDimension.ts b/src/features/bookings/hooks/useCalculateSeatsDimension.ts index 4c5e2a47..aad9e5bf 100644 --- a/src/features/bookings/hooks/useCalculateSeatsDimension.ts +++ b/src/features/bookings/hooks/useCalculateSeatsDimension.ts @@ -37,7 +37,7 @@ export const useCalculateSeatsDimension = ( setGap(calculatedGap); setSeatSize(Math.min(minHeight, minWidth, minBookableCellSize)); } - }, [seats, spacing, viewHeight, bottomTabBarHeight]); + }, [seats, spacing, viewHeight, bottomTabBarHeight, basicPadding]); return { seatSize, gap }; }; diff --git a/src/features/bookings/screens/BookingSlotScreen.tsx b/src/features/bookings/screens/BookingSlotScreen.tsx index 68417654..d1d0ffa7 100644 --- a/src/features/bookings/screens/BookingSlotScreen.tsx +++ b/src/features/bookings/screens/BookingSlotScreen.tsx @@ -102,7 +102,7 @@ export const BookingSlotScreen = ({ route, navigation }: Props) => { } return oldW.plus({ week: 1 }); }), - [], + [currentTopic.agendaView], ); const prevWeek = useCallback( @@ -113,7 +113,7 @@ export const BookingSlotScreen = ({ route, navigation }: Props) => { } return oldW.minus({ week: 1 }); }), - [], + [currentTopic.agendaView], ); useLayoutEffect(() => { @@ -275,7 +275,7 @@ export const BookingSlotScreen = ({ route, navigation }: Props) => { date={currentWeekStart} locale={language} hours={hours} - bodyContainerStyle={{ backgroundColor: 'yellow' }} + bodyContainerStyle={{ backgroundColor: colors.yellow }} cellMaxHeight={currentTopic.slotLength || CALENDAR_CELL_HEIGHT} showAllDayEventCell={false} swipeEnabled={false} diff --git a/src/features/courses/screens/CourseDirectoryScreen.tsx b/src/features/courses/screens/CourseDirectoryScreen.tsx index 28392dea..eefd0f68 100644 --- a/src/features/courses/screens/CourseDirectoryScreen.tsx +++ b/src/features/courses/screens/CourseDirectoryScreen.tsx @@ -49,7 +49,7 @@ const FileCacheChecker = () => { useFocusEffect( useCallback(() => { refresh(); - }, []), + }, [refresh]), ); // eslint-disable-next-line react/jsx-no-useless-fragment diff --git a/src/features/courses/screens/CourseIconPickerScreen.tsx b/src/features/courses/screens/CourseIconPickerScreen.tsx index 1c3d5080..58ed6b76 100644 --- a/src/features/courses/screens/CourseIconPickerScreen.tsx +++ b/src/features/courses/screens/CourseIconPickerScreen.tsx @@ -45,7 +45,7 @@ export const CourseIconPickerScreen = ({ navigation, route }: Props) => { onChangeText: e => setSearchFilter(e.nativeEvent.text.toLowerCase()), }, }); - }, []); + }, [navigation]); return ( <> diff --git a/src/features/guides/screens/GuideScreen.tsx b/src/features/guides/screens/GuideScreen.tsx index f110c2d9..ab42a6e7 100644 --- a/src/features/guides/screens/GuideScreen.tsx +++ b/src/features/guides/screens/GuideScreen.tsx @@ -42,7 +42,7 @@ export const GuideScreen = ({ navigation, route }: Props) => { navigation.setOptions({ headerTitle: guide?.listTitle, }); - }, [guide, navigation]); + }, [guide, navigation, emailGuideRead, updatePreference]); return ( { const { t } = useTranslation(); - const placeCategoriesMap = usePlaceCategoriesMap(); return useCallback( (place: SearchPlace, isRecentlyViewed = false) => { - const markerUrl = !placeCategoriesMap - ? DEFAULT_CATEGORY_MARKER.markerUrl - : place.category?.subCategory?.id - ? placeCategoriesMap[place.category.subCategory.id].markerUrl - : place.category.id - ? placeCategoriesMap[place.category.id]?.markerUrl - : DEFAULT_CATEGORY_MARKER.markerUrl; return { title: isPlace(place) ? place.room.name ?? place.category.subCategory?.name @@ -40,6 +30,6 @@ export const useSearchPlaceToListItem = () => { // ), }; }, - [placeCategoriesMap, t], + [t], ); }; diff --git a/src/features/places/screens/EventPlacesScreen.tsx b/src/features/places/screens/EventPlacesScreen.tsx index a92ec751..4b644664 100644 --- a/src/features/places/screens/EventPlacesScreen.tsx +++ b/src/features/places/screens/EventPlacesScreen.tsx @@ -140,6 +140,7 @@ export const EventPlacesScreen = ({ navigation, route }: Props) => { placesQueries, safeAreaInsets.top, spacing, + isCrossNavigation, ]); if (isLoading) { diff --git a/src/features/places/screens/FreeRoomsScreen.tsx b/src/features/places/screens/FreeRoomsScreen.tsx index a385916a..81e547d9 100644 --- a/src/features/places/screens/FreeRoomsScreen.tsx +++ b/src/features/places/screens/FreeRoomsScreen.tsx @@ -179,7 +179,7 @@ export const FreeRoomsScreen = ({ navigation }: Props) => { } else { setShowFeedback(false); } - }, [startDateTime, t]); + }, [startDateTime, t, showFeedback, setFeedback]); const { data: sitePlaces } = useSearchPlaces({ siteId: campus?.id }); @@ -234,7 +234,7 @@ export const FreeRoomsScreen = ({ navigation }: Props) => { ), }); - }, [displayFloorId, navigation, places]); + }, [displayFloorId, navigation, places, tabBarHeight, headerHeight]); return ( diff --git a/src/features/teaching/components/ExamListItem.tsx b/src/features/teaching/components/ExamListItem.tsx index 4421f2ef..1e202e29 100644 --- a/src/features/teaching/components/ExamListItem.tsx +++ b/src/features/teaching/components/ExamListItem.tsx @@ -59,10 +59,9 @@ export const ExamListItem = ({ } return { - // subtitle: `${dateTime}`, accessibilityLabel: `${accessibilityLabel} ${exam.courseName} ${accessibleDateTime} ${status}`, }; - }, [accessibilityLabel, exam, t]); + }, [accessibilityLabel, exam, t, formatHHmm]); return ( { const { fontSizes, spacing } = useTheme(); const examsQuery = useGetExams(); const cpdSurveysQuery = useGetAllCpdSurveys(); - const cpd = useGetCpdSurveys(); const exam = examsQuery.data?.find(e => e.id === id); const teacherQuery = useGetPerson(exam?.teacherId); const routes = navigation.getState()?.routes; @@ -101,7 +97,7 @@ export const ExamScreen = ({ route, navigation }: Props) => { }`; return `${exam.courseName}. ${accessibleDateTime}. ${classrooms} ${teacher}`; - }, [exam, t, teacherQuery]); + }, [exam, t, teacherQuery, formatHHmm]); useLayoutEffect(() => { if (!cpdSurveysQuery.data || !exam) return; @@ -123,7 +119,7 @@ export const ExamScreen = ({ route, navigation }: Props) => { showBottomModal( , ); - }, [cpdSurveysQuery.data, exam]); + }, [cpdSurveysQuery.data, exam, showBottomModal, closeBottomModal]); return ( <> diff --git a/src/features/tickets/screens/CreateTicketScreen.tsx b/src/features/tickets/screens/CreateTicketScreen.tsx index d10646e5..99656925 100644 --- a/src/features/tickets/screens/CreateTicketScreen.tsx +++ b/src/features/tickets/screens/CreateTicketScreen.tsx @@ -64,7 +64,7 @@ export const CreateTicketScreen = ({ navigation, route }: Props) => { navigation.navigate(initialTopicId ? 'Services' : 'Tickets'); navigation.navigate('Ticket', { id: data.id }); } - }, [isSuccess, data]); + }, [isSuccess, data, initialTopicId, navigation]); const subTopics = useMemo( () => diff --git a/src/features/tickets/screens/TicketFaqsScreen.tsx b/src/features/tickets/screens/TicketFaqsScreen.tsx index 8afecee1..d7681eb6 100644 --- a/src/features/tickets/screens/TicketFaqsScreen.tsx +++ b/src/features/tickets/screens/TicketFaqsScreen.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { AccessibilityInfo, @@ -48,9 +48,14 @@ export const TicketFaqsScreen = ({ navigation }: Props) => { const [search, setSearch] = useState(''); const [hasSearchedOnce, setHasSearchedOnce] = useState(false); const ticketFaqsQuery = useSearchTicketFaqs(search); - const ticketFaqs = - ticketFaqsQuery.data?.sort((a, b) => (a.question > b.question ? 1 : -1)) ?? - []; + const ticketFaqs = useMemo(() => { + return ( + ticketFaqsQuery.data?.sort((a, b) => + a.question > b.question ? 1 : -1, + ) ?? [] + ); + }, [ticketFaqsQuery.data]); + const canSearch = search?.length > 2; const { accessibilityListLabel } = useAccessibility(); diff --git a/src/features/tickets/screens/TicketListScreen.tsx b/src/features/tickets/screens/TicketListScreen.tsx index 8541773d..b7bd327f 100644 --- a/src/features/tickets/screens/TicketListScreen.tsx +++ b/src/features/tickets/screens/TicketListScreen.tsx @@ -28,7 +28,7 @@ export const TicketListScreen = ({ route }: Props) => { ticketsQuery.data ?.filter(ticket => statuses.includes(ticket.status)) ?.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime()) ?? [], - [ticketsQuery], + [ticketsQuery, statuses], ); const labels = useMemo(() => { diff --git a/src/features/tickets/screens/TicketScreen.tsx b/src/features/tickets/screens/TicketScreen.tsx index b86dc6f9..ac08704e 100644 --- a/src/features/tickets/screens/TicketScreen.tsx +++ b/src/features/tickets/screens/TicketScreen.tsx @@ -78,7 +78,7 @@ const HeaderRight = ({ ticket }: { ticket: TicketOverview }) => { if (isSuccess) { navigation.navigate('Tickets'); } - }, [isSuccess]); + }, [isSuccess, navigation]); if (ticket?.status !== TicketStatus.Closed) { return ( diff --git a/src/features/transcript/components/ProvisionalGradeListItem.tsx b/src/features/transcript/components/ProvisionalGradeListItem.tsx index 5b7bcfc5..6c27bd49 100644 --- a/src/features/transcript/components/ProvisionalGradeListItem.tsx +++ b/src/features/transcript/components/ProvisionalGradeListItem.tsx @@ -54,7 +54,15 @@ export const ProvisionalGradeListItem = ({ grade }: Props) => { default: return undefined; } - }, [grade.rejectedAt, grade.state, rejectionTime, t]); + }, [ + grade.rejectedAt, + grade.state, + rejectionTime, + t, + formatHHmm, + grade.canBeRejected, + styles.rejectableSubtitle, + ]); return ( { const styles = useStylesheet(createStyles); const gradesQuery = useGetGrades(); const provisionalGradesQuery = useGetProvisionalGrades(); - const { accessibilityListLabel } = useAccessibility(); const isOffline = useOfflineDisabled(); diff --git a/src/features/transcript/screens/RecordedGradeScreen.tsx b/src/features/transcript/screens/RecordedGradeScreen.tsx index fe4cd265..012df4d1 100644 --- a/src/features/transcript/screens/RecordedGradeScreen.tsx +++ b/src/features/transcript/screens/RecordedGradeScreen.tsx @@ -39,7 +39,6 @@ export const RecordedGradeScreen = ({ navigation, route }: Props) => { const staffQueries = useGetPerson(teacherIds); const styles = useStylesheet(createStyles); - const isNumber = (value: string): boolean => !isNaN(Number(value)); const { open: showBottomModal,