Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Search page alerts #1182

Merged
merged 162 commits into from
Jun 27, 2024
Merged

feat: Search page alerts #1182

merged 162 commits into from
Jun 27, 2024

Conversation

kuck1
Copy link
Contributor

@kuck1 kuck1 commented Mar 22, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: IN-941

What is the new behavior?

  • Banner at the top of the search for the US
  • Dynamic banner above results different per state

Does this introduce a breaking change?

  • Yes
  • No

Other information

Screen.Recording.2024-03-22.at.1.45.15.PM.mov

Summary by CodeRabbit

  • New Features

    • Introduced location-based alert banners with variations for statewide, county-level, and nationwide alerts.
    • Enhanced search functionality with refined alert messages and travel advisories.
    • Added new color definitions: lightPink and lightGreen.
  • Bug Fixes

    • Replaced outdated alert messages and removed deprecated ones to ensure up-to-date information.
  • Documentation

    • Updated Storybook to showcase scenarios for LocationBasedAlertBanner component.
  • Refactor

    • Refined state management and logic for alert banners in the search page.
    • Updated SearchBox component to use setSearchValue prop.
  • Chores

    • Added specific versions for react and react-dom to peerDependencyRules.
    • Updated database schema and migration scripts for improved alert level categorization.

@kuck1 kuck1 requested a review from JoeKarow as a code owner March 22, 2024 20:52
Copy link

vercel bot commented Mar 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
inreach-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2024 3:21pm

@github-actions github-actions bot added automerge Enable Kodiak auto-merge kodiak: merge.method = 'squash' Kodiak will squash merge this PR. 📦 app 📦 ui labels Mar 22, 2024
Copy link

alwaysmeticulous bot commented Mar 22, 2024

🤖 No test run has been triggered as your Meticulous project has been deactivated (since you haven't viewed any test results in a while). Click here to reactivate.

Last updated for commit 0ef1740. This comment will update as new commits are pushed.

Copy link
Contributor

github-actions bot commented Mar 22, 2024

📦 Next.js Bundle Analysis for @weareinreach/app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0b4e790 and 06d54b7.

Files selected for processing (1)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 06d54b7 and 175689a.

Files selected for processing (1)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 175689a and a3cd58d.

Files selected for processing (2)
  • InReach.code-workspace (1 hunks)
  • packages/db/prisma/schema.prisma (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • InReach.code-workspace
  • packages/db/prisma/schema.prisma

Copy link
Contributor

kodiakhq bot commented Jun 25, 2024

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@github-actions github-actions bot added the automerge Enable Kodiak auto-merge label Jun 25, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a3cd58d and bc7c7a6.

Files selected for processing (1)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc7c7a6 and 1163c09.

Files selected for processing (4)
  • apps/app/public/locales/en/common.json (1 hunks)
  • packages/db/prisma/data-migrations/2024-06-27_search-page-alert.ts (1 hunks)
  • packages/db/prisma/data-migrations/index.ts (1 hunks)
  • packages/ui/components/core/LocationBasedAlertBanner/index.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/db/prisma/data-migrations/index.ts
Files skipped from review as they are similar to previous changes (2)
  • apps/app/public/locales/en/common.json
  • packages/ui/components/core/LocationBasedAlertBanner/index.tsx
Additional context used
Biome
packages/db/prisma/data-migrations/2024-06-27_search-page-alert.ts

[error] 21-21: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (3)
packages/db/prisma/data-migrations/2024-06-27_search-page-alert.ts (3)

55-55: Ensure the job completion record is correctly written to the database.

This is a critical step to ensure that the migration is registered as having run successfully. Verify that jobPostRunner correctly logs the job completion.

Verification successful

Ensure the job completion record is correctly written to the database.

The jobPostRunner function includes logic to create a record in the database using prisma.dataMigration.create({ data: jobDef }). This ensures that the migration is registered as having run successfully.

  • File: ./packages/db/prisma/jobPreRun.ts
  • Implementation:
    export const jobPostRunner = async (jobDef: JobDef) => {
        try {
            await prisma.dataMigration.create({ data: jobDef })
        } catch (err) {
            console.error(err)
            throw err
        }
    }

This confirms that the job completion record is correctly written to the database.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the job completion record is correctly written to the database.

# Test: Check the database to ensure that the job completion record exists.
echo "Check database for job completion record"

Length of output: 90



Script:

#!/bin/bash
# Locate the implementation of jobPostRunner function and check for database logging logic
echo "Searching for jobPostRunner function implementation"
job_post_runner_file=$(fd -e ts -e js -x gawk '/function jobPostRunner|const jobPostRunner =/ {print FILENAME}' {} +)
echo "Found jobPostRunner implementation in: $job_post_runner_file"

echo "Checking for database logging logic in jobPostRunner"
grep -E 'insert|update|log|write' "$job_post_runner_file"

# Check for related tests or logs
echo "Searching for tests related to jobPostRunner"
fd -e ts -e js -x grep -l 'jobPostRunner' {}

Length of output: 67224



Script:

#!/bin/bash
# Extract the full implementation of jobPostRunner function and check for database operations
echo "Extracting jobPostRunner function implementation"
ast-grep --lang typescript --pattern $'function jobPostRunner($$$) {
  $$$
}' ./packages/db/prisma/jobPreRun.ts

# Inspect related test files for assertions on job completion logging
echo "Inspecting related test files"
fd -e ts -e js -x grep -A 5 -B 5 'jobPostRunner' {}

Length of output: 5796


48-48: Logging of created alert should be verified for correctness.

Ensure that the log function is called correctly and that the newAlert.id is properly retrieved and logged.


34-46: Review the creation of newAlert for potential issues.

Ensure that the id and text fields are correctly generated and connected. The use of generateNestedFreeText seems appropriate for generating nested text, but verify that the freeTextId and itemId are correctly set up to reference valid entries.

Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1163c09 and 0ef1740.

Files selected for processing (1)
  • packages/ui/components/core/LocationBasedAlertBanner/index.stories.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/ui/components/core/LocationBasedAlertBanner/index.stories.tsx

@JoeKarow
Copy link
Collaborator

@coderabbitai resolve

Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Actions performed

Comments resolved.

@kodiakhq kodiakhq bot merged commit ce7e000 into dev Jun 27, 2024
27 of 28 checks passed
@kodiakhq kodiakhq bot deleted the search-page-alerts branch June 27, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 api 📦 app automerge Enable Kodiak auto-merge 📦 db kodiak: merge.method = 'squash' Kodiak will squash merge this PR. new-feature New features or options. 📦 ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants