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: crisis support sections #677

Merged
merged 88 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
788778d
kysely codegen
JoeKarow Jul 20, 2023
4314808
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 24, 2023
5f25484
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 24, 2023
c5a069c
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 24, 2023
7139bd6
Merge branch 'dev' into IN-909-create-international-national
JoeKarow Jul 24, 2023
a4c8004
fix lockfile
JoeKarow Jul 24, 2023
0d152a3
chore: lint & format
InReach-svc Jul 24, 2023
57def90
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 25, 2023
965a0c5
data migration: add intl crisis support
JoeKarow Jul 24, 2023
57fc4a9
remove old fields
JoeKarow Jul 24, 2023
c7149ef
generated data
JoeKarow Jul 25, 2023
440a3bc
prebuild tasks, env updates, deps
JoeKarow Jul 25, 2023
2b8970f
update search params & handling
JoeKarow Jul 25, 2023
6127ba1
use streaming http link
JoeKarow Jul 25, 2023
85deaf9
middleware starter
JoeKarow Jul 25, 2023
11396ef
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 25, 2023
54db9cd
fix env
JoeKarow Jul 26, 2023
75eb955
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 26, 2023
c0dac15
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Jul 26, 2023
e56ceae
fix lockfile
JoeKarow Jul 26, 2023
7f601ca
ignore renovate branches
JoeKarow Jul 26, 2023
0fb1ac6
move in to types dir
JoeKarow Jul 26, 2023
4903959
extract handlers & schemas
JoeKarow Jul 26, 2023
eca2807
create Intl Crisis handler
JoeKarow Jul 26, 2023
21980bb
lazy load handlers for SPEED
JoeKarow Jul 26, 2023
bd8dcb5
update deps
JoeKarow Jul 26, 2023
eec1555
update migration to attach service tags
JoeKarow Jul 26, 2023
fc879a9
fix error from blank search
JoeKarow Jul 26, 2023
a5f33ca
use typedef from next-routes
JoeKarow Jul 26, 2023
24f7cfa
update template/runner
JoeKarow Jul 26, 2023
31abd75
api: get country translation info
JoeKarow Jul 26, 2023
c07fe1e
add sorting for intl crisis orgs
JoeKarow Jul 26, 2023
a88fd36
add option to hide tooltip
JoeKarow Jul 26, 2023
d86c15b
remove console log
JoeKarow Jul 26, 2023
fe79034
fix sidebar loading state, add disabled state to buttons
JoeKarow Jul 26, 2023
ba45750
create intl crisis page
JoeKarow Jul 26, 2023
92a70a8
fix types
JoeKarow Jul 26, 2023
41b7c6f
update ignores
JoeKarow Jul 26, 2023
0eb0f39
chore: lint & format
InReach-svc Jul 26, 2023
8caa748
add field for article prefix
JoeKarow Jul 27, 2023
be0efaa
api - update edge config for countries
JoeKarow Jul 27, 2023
e34273a
update search state context
JoeKarow Jul 28, 2023
705d0b2
add namespace
JoeKarow Jul 28, 2023
6509d0c
check if loaded before attempting to render
JoeKarow Jul 28, 2023
fc8efee
update configs
JoeKarow Jul 28, 2023
4487129
create page with dynamic route
JoeKarow Jul 28, 2023
d535b4f
create global loading state handler
JoeKarow Jul 28, 2023
8bc8248
pretty errors
JoeKarow Jul 28, 2023
e03e0fd
chore: lint & format
InReach-svc Jul 28, 2023
1a4318e
remove ns
JoeKarow Jul 28, 2023
fe67d01
skip validation in dev env
JoeKarow Jul 28, 2023
b014e9d
extract state for easier debug, add placeholder override
JoeKarow Jul 28, 2023
cb74feb
add tabbed searchbox
JoeKarow Jul 28, 2023
dbf2f05
export loading state
JoeKarow Jul 28, 2023
a6eddb8
scaffold feature flag hook
JoeKarow Jul 28, 2023
848150e
ability to reset state on route push when page component is the same
JoeKarow Jul 28, 2023
a4bc1ef
remove duplicate condition
JoeKarow Jul 28, 2023
ed9311c
clear query params from url for unsupported country
JoeKarow Jul 28, 2023
0931102
update loading state
JoeKarow Jul 28, 2023
244a310
remove console.log
JoeKarow Jul 28, 2023
e496bd7
chore: lint & format
InReach-svc Jul 28, 2023
25a8ccb
update fallback
JoeKarow Jul 28, 2023
f16707f
update job cache
JoeKarow Jul 28, 2023
87dbc43
ignore "monitoring" route
JoeKarow Jul 28, 2023
a46d995
move feature flag to api
JoeKarow Jul 28, 2023
58bb89a
fix middleware matcher
JoeKarow Jul 28, 2023
4212d81
update config
JoeKarow Jul 28, 2023
1ce8d7d
Merge branch 'dev' into IN-909-create-international-national
JoeKarow Jul 31, 2023
e45ccc5
chore: lint & format
InReach-svc Jul 31, 2023
82d72b7
data migration: add crisis flags, create new tags
JoeKarow Jul 31, 2023
2378884
redirect to home
JoeKarow Jul 31, 2023
1274ac8
IN-908 temporarily replace login button with "Coming soon"
JoeKarow Jul 31, 2023
9d9f527
i18n for new attribute/categories
JoeKarow Jul 31, 2023
4a608c1
create db tools cli
JoeKarow Jul 31, 2023
201ce2e
generated data
JoeKarow Jul 31, 2023
8556e56
fix var
JoeKarow Jul 31, 2023
816cdcb
do not deserialize if it's already deserialized
JoeKarow Jul 31, 2023
82a9990
create getNationalCrisis route
JoeKarow Jul 31, 2023
f38a4ae
crisis components
JoeKarow Jul 31, 2023
aad234b
data migration: crisis support resources
JoeKarow Jul 31, 2023
07571b7
chore: lint & format
InReach-svc Jul 31, 2023
9ca5199
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Aug 1, 2023
0a7a6f4
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Aug 1, 2023
be7f9cf
Merge branch 'dev' into IN-909-create-international-national
kodiakhq[bot] Aug 1, 2023
4759532
generated data
JoeKarow Aug 1, 2023
2efc4df
add no-results condition to main search results, clean up imports
JoeKarow Aug 1, 2023
c5e327b
redirect /search to /
JoeKarow Aug 1, 2023
2124ad5
use Intl for country name translations
JoeKarow Aug 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ on:
# - dev
- main
- l10n_**
- renovate/*

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
# permissions:
# contents: write
# pull-requests: write

steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ _generated/*

packages/db/backup

# internal temp scripts
___*.ts
47 changes: 47 additions & 0 deletions apps/app/lib/prebuild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Listr, type ListrDefaultRenderer, type ListrTask as ListrTaskObj, PRESET_TIMER } from 'listr2'

import fs from 'fs'
import path from 'path'

import { getEnv } from '@weareinreach/env'

const renderOptions = {
bottomBar: 10,
persistentOutput: true,
timer: PRESET_TIMER,
} satisfies ListrJob['options']
const injectOptions = (job: ListrJob): ListrJob => ({ ...job, options: renderOptions })

const tasks = new Listr(
[
injectOptions({
title: 'Inject CRON_KEY into vercel.json',
task: (_, task) => {
if (getEnv('VERCEL_ENV') !== 'production') {
return task.skip(`${task.title} (Not production deployment)`)
}
const regex = /\{\{KEY\}\}/
const vercelConfigFile = path.resolve(__dirname, '../vercel.json')
const vercelConfig = fs.readFileSync(vercelConfigFile, 'utf8')
fs.writeFileSync(vercelConfigFile, vercelConfig.replace(regex, getEnv('CRON_KEY')))
},
}),
],
{
rendererOptions: {
formatOutput: 'wrap',
timer: PRESET_TIMER,
suffixSkips: true,
collapseSubtasks: false,
},
fallbackRendererOptions: {
timer: PRESET_TIMER,
},
exitOnError: false,
forceColor: true,
}
)

tasks.run()

export type ListrJob = ListrTaskObj<unknown, ListrDefaultRenderer>
34 changes: 7 additions & 27 deletions apps/app/next-i18next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* eslint-disable turbo/no-undeclared-env-vars */
/* eslint-disable node/no-process-env */
// @ts-check
/* eslint-disable import/no-unused-modules */
// import axios from 'axios'
import LanguageDetector from 'i18next-browser-languagedetector'
import ChainedBackend from 'i18next-chained-backend'
import HttpBackend from 'i18next-http-backend'
import intervalPlural from 'i18next-intervalplural-postprocessor'
// import LocalStorageBackend from 'i18next-localstorage-backend'
import MultiBackend from 'i18next-multiload-backend-adapter'
// import { z } from 'zod'

import path from 'path'

Expand Down Expand Up @@ -42,32 +40,22 @@ const getUrl = (path) => {
return `http://localhost:${process.env.PORT ?? 3000}${parsedPath}` // dev SSR should use localhost
}

// const crowdinBackend = new CrowdinOtaBackend(undefined, )
const apiPath = '/api/i18n/load?lng={{lng}}&ns={{ns}}'
// const httpBackend = new HttpBackend(null, {
// loadPath: getUrl(apiPath), //typeof window !== 'undefined' ? apiPath : `http://localhost:3000${apiPath}`,
// allowMultiLoading: true,
// })

const multi = new MultiBackend(null, {
backend: HttpBackend,
// debounceInterval: 200,
backendOption: {
loadPath: getUrl(apiPath), //typeof window !== 'undefined' ? apiPath : `http://localhost:3000${apiPath}`,
loadPath: getUrl(apiPath),
allowMultiLoading: true,
},
})

/**
* @template {import('next-i18next').UserConfig} T
* @type {import('next-i18next').UserConfig}
* @param {T} config
* @constraint {{import('next-i18next').UserConfig}}
*/
/** @type {import('next-i18next').UserConfig} */
const config = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'es', 'fr', 'ar', 'ru'], // ['en', 'en-US', 'en-CA', 'en-MX', 'es', 'es-US', 'es-MX'],
locales: ['en', 'es', 'fr', 'ar', 'ru'],
},
defaultNS: 'common',
localePath: path.resolve('./public/locales'),
Expand All @@ -85,26 +73,19 @@ const config = {

backend: {
backendOptions: [
// {
// expirationTime: 60 * 60 * 1000,
// },
{
backend: HttpBackend,
// debounceInterval: 200,
backendOption: {
loadPath: getUrl(apiPath), //isBrowser ? apiPath : `http://localhost:3000${apiPath}`,
loadPath: getUrl(apiPath),
allowMultiLoading: true,
},
},
],
backends: isBrowser ? [multi] : [], //[LocalStorageBackend, multi] : [],
backends: isBrowser ? [multi] : [],
},

// saveMissing: true,

// updateMissing: true,
serializeConfig: false,
use: isBrowser ? [ChainedBackend, intervalPlural] : [intervalPlural],
use: isBrowser ? [ChainedBackend, intervalPlural, LanguageDetector] : [intervalPlural, LanguageDetector],
maxParallelReads: 20,
joinArrays: '',
interpolation: {
Expand All @@ -120,6 +101,5 @@ const config = {
return value
},
},
// postProcess: ['interval'],
}
export default config
34 changes: 10 additions & 24 deletions apps/app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable turbo/no-undeclared-env-vars */
/* eslint-disable node/no-process-env */
// import { env } from './src/env/server.mjs'
/* eslint-disable import/first */

import bundleAnalyze from '@next/bundle-analyzer'
import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin'
Expand All @@ -12,20 +10,13 @@ import path from 'path'
import { fileURLToPath } from 'url'

import i18nConfig from './next-i18next.config.mjs'
// import * as otel from './otel.mjs'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const isVercelActiveDev = process.env.VERCEL_ENV === 'preview' && process.env.VERCEL_GIT_COMMIT_REF !== 'dev'
const isDev = process.env.NODE_ENV === 'development'

// const loadOtel = async () => {
// if (process.env.NEXT_RUNTIME === 'nodejs') {
// await import('./otel.mjs')
// }
// }

/* eslint-disable-next-line turbo/no-undeclared-env-vars */
const withBundleAnalyzer = bundleAnalyze({ enabled: process.env.ANALYZE === 'true' })
/** @type {import('next').NextConfig} */
const nextConfig = {
Expand All @@ -37,24 +28,20 @@ const nextConfig = {
...(process.env.VERCEL_ENV === 'production' ? { removeConsole: { exclude: ['error'] } } : {}),
},
experimental: {
// fontLoaders: [{ loader: 'next/font/google', options: { subsets: ['latin'] } }],
outputFileTracingExcludes: {
'*': ['**swc+core**', '**esbuild**'],
},
outputFileTracingRoot: path.join(__dirname, '../../'),
instrumentationHook: true,
// turbotrace: {
// logDetail: true,
// },
},
eslint: {
ignoreDuringBuilds: isVercelActiveDev,
},
images: {
remotePatterns: [
{protocol: 'https', hostname: '**.4sqi.net'}
]
images: {
remotePatterns: [{ protocol: 'https', hostname: '**.4sqi.net' }],
},
rewrites: async () => [{ source: '/search', destination: '/' }],

typescript: {
ignoreBuildErrors: isVercelActiveDev,
},
Expand All @@ -63,6 +50,7 @@ const nextConfig = {
config.plugins = [...config.plugins, new PrismaPlugin()]
}
config.plugins.push(new webpack.DefinePlugin({ __SENTRY_DEBUG__: false }))

return config
},
}
Expand All @@ -75,8 +63,7 @@ const nextConfig = {
* @returns {T}
*/
function defineNextConfig(config) {
// loadOtel()
return withBundleAnalyzer(withRoutes()(config))
return withBundleAnalyzer(withRoutes({ outDir: './src/types' })(config))
}
/**
* Wraps NextJS config with the Sentry config.
Expand All @@ -94,7 +81,6 @@ const defineSentryConfig = (nextConfig) =>

// Suppresses source map uploading logs during build
silent: true,

org: 'weareinreach',
project: 'inreach-app',
},
Expand All @@ -106,7 +92,7 @@ const defineSentryConfig = (nextConfig) =>
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
transpileClientSDK: false,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: '/monitoring',
Expand All @@ -118,5 +104,5 @@ const defineSentryConfig = (nextConfig) =>
disableLogger: true,
}
)
// export default defineNextConfig(nextConfig)
export default defineSentryConfig(defineNextConfig(nextConfig))

export default isDev ? defineNextConfig(nextConfig) : defineSentryConfig(defineNextConfig(nextConfig))
4 changes: 3 additions & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "GPL-3.0-only",
"scripts": {
"build": "next build",
"build:prebuild": "SKIP_ENV_VALIDATION=true tsx ./lib/prebuild.ts",
"clean:node": "rm -rf ./node_modules/ || true && rm -rf ./.next || true",
"dev": "next dev",
"dev:verbose": "NEXT_VERBOSE=1 next dev",
Expand Down Expand Up @@ -66,6 +67,7 @@
"@trpc/react-query": "10.36.0",
"@trpc/server": "10.36.0",
"@vercel/analytics": "1.0.1",
"@vercel/edge-config": "0.2.1",
"@vercel/kv": "0.2.2",
"@weareinreach/api": "workspace:*",
"@weareinreach/auth": "workspace:*",
Expand Down Expand Up @@ -95,7 +97,7 @@
"next-auth": "4.22.3",
"next-i18next": "14.0.0",
"next-seo": "6.1.0",
"nextjs-routes": "1.0.9",
"nextjs-routes": "2.0.1",
"object-sizeof": "2.6.3",
"pretty-bytes": "6.1.1",
"react": "18.2.0",
Expand Down
8 changes: 7 additions & 1 deletion apps/app/public/locales/en/attribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"cost-fees": "Incurs a cost",
"cost-free": "Free of cost"
},
"crisis-support-community": {
"elders": "Elders",
"general-lgbtq": "General LGBTQ+"
},
"eligibility": {
"CATEGORYNAME": "Eligibility Requirements",
"elig-age_max": "Under {{max}}",
Expand Down Expand Up @@ -106,7 +110,9 @@
"accesslocation": "Access Instructions - Location",
"accessphone": "Access Instructions - Phone",
"accesspublictransit": "Access Instructions - Public Transit",
"accesstext": "Access Instructions - Text"
"accesssms": "Access Instructions - SMS",
"accesstext": "Access Instructions - Text",
"accesswhatsapp": "Access Instructions - WhatsApp"
},
"srvfocus": {
"CATEGORYNAME": "Service Focus",
Expand Down
18 changes: 18 additions & 0 deletions apps/app/public/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"about-us": "About Us",
"access": {
"sms-with-body": "Text <strong>{{body}}</strong> to {{code}}"
},
"accessible-building_false": "This building is NOT wheelchair accessible",
"accessible-building_true": "This building is wheelchair accessible",
"account": "Account",
Expand Down Expand Up @@ -50,6 +53,15 @@
},
"country-select": "Choose a country",
"create-new-list": "Create new list",
"crisis-support": {
"intl-stay-safe": "<Title3>📣 Please stay safe online</Title3>\n<Text>Visiting any of these websites <strong>may leave a record on your computer or browser</strong>, just like any website does after you visit it. Please take steps to avoid unsafe situations in your own area.</Text>",
"intl-these-verified": "These verified resources can help the LGBTQ+ community anywhere in the world.",
"intl-we-recommend": "We recommend these international resources",
"natl-find-help-now": "Find help now",
"natl-these-verified": "<Text>These verified resources can help the LGBTQ+ community in the United States. These services are <strong>remotely available, confidential,</strong> and <strong>free</strong>.</Text>",
"outside-service-area": "Inreach does not operate in {{country}}",
"who-this-serves": "<Text><strong>Who this resource serves:</strong> {{targetPop}}</Text>"
},
"current-location": "Current location",
"delete-account": "Delete your account?",
"delete-account-password": "Enter your account password to confirm.",
Expand Down Expand Up @@ -212,9 +224,12 @@
"search": {
"include-remote": "Include remote services",
"location-placeholder": "Enter city or zip code...",
"location-placeholder-searchby": "Search by city or zip code...",
"look-up-org": "Look up an organization by name",
"no-results": "No results found. Please try again.",
"no-results-adjust": "No results found for your search. Try adjusting your selected location or filters.",
"organization-placeholder": "Enter organization name...",
"organization-placeholder-searchby": "Search by organization name...",
"suggest-resource": "Can't find it? <1>Suggest an organization</1> you think should be included."
},
"send-email": "Send email",
Expand Down Expand Up @@ -353,9 +368,11 @@
"email": "Email",
"home": "Home",
"hours": "Hours",
"location": "Location",
"more": "more",
"next": "Next",
"no": "No",
"organization": "Organization",
"password": "Password",
"phone": "Phone",
"please-wait": "Please wait...",
Expand All @@ -372,6 +389,7 @@
"sign-up": "Sign up",
"skip": "Skip",
"support": "Support",
"website": "Website",
"yes": "Yes"
}
}
Loading
Loading