Skip to content

Commit

Permalink
v1 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
devowhippit committed Aug 3, 2021
1 parent ea56e2a commit d9a7f5f
Show file tree
Hide file tree
Showing 356 changed files with 11,386 additions and 135,225 deletions.
104 changes: 18 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# MHFA
# Mental Health for All

Work-in-progress.
Mental Health for All provides a directory of resources for New Yorkers seeking help for anxiety, trauma, substance misuse, and more. This repository contains the content and source code for the site. It uses the [NYCO Patterns CLI](https://github.com/CityOfNewYork/patterns-cli) to generate a static build of the 20+ service pages styled using the [Growing Up Patterns](https://github.com/NYCOpportunity/growingupnyc-patterns). The service directory (or archive) uses the [NYCO WordPress Archive Vue](https://github.com/CityOfNewYork/nyco-wp-archive-vue/) to filter the services.

## Contributing
### Contributing

As of right now this project should be relative to the Growing Up Patterns.
As of right now the project should be relative to the Growing Up Patterns when developing.

```
- 📁 growingupnyc-patterns
Expand All @@ -26,97 +26,29 @@ $ npm install
$ npm start
```

## CHANGELOG
### Growing Up Patterns

### JavaScript Enhancements to Integrate
The Growing Up Patterns are re-configured for the site to use [custom **Mental Health for All** design tokens](config/tokens.js) (fonts, colors, and media breakpoints). These are used by the [Tailwindcss configuration](config/tailwindcss.js) to generate a custom CSS utilities and the [main site stylesheet](src/scss/_site.scss) with new background images and other pattern overrides.

* [ ] Google Translate Element (need to pull example from [one of our sites, ACCESS?](https://github.com/CityOfNewYork/ACCESS-NYC/blob/main/wp-content/themes/access/src/js/modules/google-translate-element.js))
* [ ] Web Share Component (available in the [Patterns Scripts library](https://github.com/CityOfNewYork/patterns-scripts/tree/main/src/web-share))
### Commands

### v0.0.0-5

Implemented of [NYCO WP Archive Vue](https://github.com/CityOfNewYork/nyco-wp-archive-vue) application for filtering Services.

### v0.0.0-4

Implemented first round of content and design of Services.

### v0.0.0-3

Integrated the following items.

* [x] Integrate the icons
* [x] Potentially use CDN for Styles and Icons (SVGs)
* [x] Get JavaScript to work (modules need to be implemented on an as needed basis)
* [x] Single program template (Trauma Support)

### v0.0.0-2

Integrated the following items.

* [x] Styles (locally compiled)
* [x] Scripts (CDN)
* [x] Default layout
* [x] Partials directory with some objects and components
* [x] Homepage template
* [x] Archive template

To dos.

* [ ] Integrate the icons
* [ ] Get JavaScript to work
* [ ] Potentially use CDN for Styles and Icons (SVGs)

### v0.0.0-1

Initialized an NPM/Node.js project.

```
$ npm init
```

Installed the @NYCOpportunity [Patterns CLI](https://github.com/CityOfNewYork/patterns-cli) and [Growing Up NYC Patterns](https://github.com/NYCOpportunity/growingupnyc-patterns).
Commands are stored in the [package.json](package.json) file and can be run using NPM. Commands follow this pattern.

```shell
$ npm install @nycopportunity/pttrn
$ npm run {{ command }}
```

The **Growing Up NYC Patterns** need to be installed as a local file dependency.
Below is a description of the available commands.

```
$ cd ../
$ git clone https://github.com/NYCOpportunity/growingupnyc-patterns
$ cd mhfa
$ npm install ../growingupnyc-patterns
```

The path **../growingupnyc-patterns** would vary if Growing Up Patterns is already cloned locally.

Ran the [pttrn scaffold command](https://github.com/CityOfNewYork/patterns-cli/#scaffold) to set up the project.

```shell
$ npx pttrn scaffold
```

Added [Pattern NPM scripts](https://github.com/CityOfNewYork/patterns-cli/#npm-scripts) to the project.

```json
"scripts": {
"start": "cross-env NODE_ENV=development concurrently \"pttrn -w\" \"pttrn serve -w\" -p \"none\"",
"version": "npm run default && git add .",
"prepublishOnly": "git push && git push --tags",
"publish": "cross-env NODE_ENV=production pttrn publish",
"default": "cross-env NODE_ENV=production pttrn"
},
```

Added **.gitignore** to the project.

```shell
$ touch .gitignore
```
Command | Arguments | Description
-----------|-------------------|-
`start` | | Runs the Pattern CLI development server with watching and reloading.
`default` | | Runs a the default Pattern CLI build command.
`version` | major/minor/patch | Hooks into the npm version script by regenerating the build with the version number.
`services` | | Regenerates all of the service `.slm` templates from the [config/services.js](config/services.js) file. This needs to be run if any changes are made to the [src/slm/service.slm](src/slm/service.slm) template or new services are added to [config/services.js](config/services.js).
`ghpages` | | Run the default command and publish to the testing environment.

Updated README.md
[Additional commands from the Patterns CLI](https://github.com/CityOfNewYork/patterns-cli#commands) can also be run. Most commands will require the `NODE_ENV` variable to be set.

---

Expand Down
81 changes: 58 additions & 23 deletions bin/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ const fs = require('fs');
const cnsl = require('@nycopportunity/pttrn/bin/util/console');
const alerts = require('@nycopportunity/pttrn/config/alerts');

const services = require('../config/slm').services;
const services = require('../config/services');

const createSlug = (s) => s
.toLowerCase()
.replace(/[^0-9a-zA-Z - _]+/g, '')
.replace(/\s+/g, '-')
.replace(/-+/g, '-')
const createSlug = (s) =>
s
.toLowerCase()
.replace(/[^0-9a-zA-Z - _]+/g, '')
.replace(/\s+/g, '-')
.replace(/-+/g, '-');

const card = {
"subtitle": '',
"title": '',
"programProvider": '',
"body": '',
"link": '',
"featured": '',
"category": {},
"population": {}
}

subtitle: '',
title: '',
programProvider: '',
body: '',
link: '',
featured: '',
categories: {},
population: {},
};

/**
* Export our methods
Expand All @@ -36,7 +36,12 @@ const card = {
module.exports = {
run: async () => {
let json = [];

let cat = []
let pop = []
let servciesJson = 'dist/data/services.json';
let termsJson = 'dist/data/terms.json';
let population = 'config/population.json'

for (let i = services.length - 1; i >= 0; i--) {
let service = services[i];
Expand All @@ -47,18 +52,19 @@ module.exports = {
let template = 'src/slm/services/service.slm';
let data = fs.readFileSync(template, 'utf8');
let slug = createSlug(service.title);
let write = `src/views/programs/${slug}.slm`;
let write = `src/views/services/${slug}.slm`;

data = data
.replace(/{{ SERVICE_TITLE }}/g, service.title)
.replace('{{ SERVICE_SLUG }}', slug);
.replace('{{ SERVICE_SLUG }}', slug)
.replace('{{ SERVICE_DESCRIPTION }}', service.metaDescription ? service.metaDescription : service.subtitle );

// if (!fs.existsSync(write)) {
await fs.writeFileSync(write, data);
await fs.writeFileSync(write, data);

cnsl.success(`${alerts.str.path(write)} was made.`);
cnsl.success(`${alerts.str.path(write)} was made.`);
// } else {
// cnsl.error(`${alerts.str.path(write)} already exists.`);
// cnsl.error(`${alerts.str.path(write)} already exists.`);
// }

/**
Expand All @@ -67,23 +73,52 @@ module.exports = {

let srvc = {};

Object.keys(card).map(key => {
Object.keys(card).map((key) => {
if (key === 'body') {
srvc[key] = service['subtitle'];
} else {
srvc[key] = service[key];
}
});

service.categories.map(category => {
category.slug = createSlug(category.name)
cat.push(category)
})

service.population.map(people => {
people.slug = createSlug(people.name)
pop.push(people)
})

json.push(srvc);
}

const unique = (arr, key) => [...new Map(arr.map(item => [item[key], item])).values()];

let terms = [
{
name: "Type of Support",
slug: "cat",
programs: unique(cat, 'id')
},
{
name: "People Served",
slug: "pop",
programs: unique(pop, 'id')
}
];

/**
* Write the services json
*/

fs.writeFileSync(servciesJson, JSON.stringify(json));
fs.writeFileSync(termsJson, JSON.stringify(terms));
// fs.writeFileSync(population, JSON.stringify(unique(pop, 'id')));

cnsl.success(`${alerts.str.path(servciesJson)} was made.`);
}
cnsl.success(`${alerts.str.path(termsJson)} was made.`);
// cnsl.success(`${alerts.str.path(population)} was made.`);
},
};
10 changes: 10 additions & 0 deletions config/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
title: 'About',
content: `
<p>In New York City, mental health care and support is not a privilege reserved for those who can afford it. It is a human right for all.</p>
<p>Mental Health For All is a central hub where every New Yorker can connect to care and find mental health resources for themselves and their loved ones. No matter the age, ZIP code, ethnicity, or gender, we want every New Yorker to be able to live their best life.</p>
<p>Mental Health For All is our commitment to every one of the 8.6 million people in our City: We will support you every step of the way in living a happy and healthy life.</p>
`
};
28 changes: 28 additions & 0 deletions config/banners.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
'About': 'about',
'The Crime Victim Assistance Program (CVAP)': 'a',
'Family Justice Centers': 'b',
'Program for Survivors of Torture': false,
'Mission: VetCheck': 'k',
'The Trevor Project': 'e',
'LGBT National Help Center': 'l',
'Mobile Treatment Services Accessible Through the Single Point of Access': 'n',
'Mobile Crisis Teams': 'm',
'Friendly Visiting and Friendly VOICES': 'g',
'Geriatric Mental Health Initiative': 'c',
'NYC Well': 'x',
'NYC Care': 'p',
'NYC Family Resource Centers': 'b',
'Early Childhood Mental Health Network': 'q',
'Comprehensive Psychiatric Emergency Services Program (CPEP) at Health + Hospitals': 'r',
'Clubhouses': false,
'School Mental Health Services': 's',
'Family Counseling': 'h',
'Drop-in Centers for Runaway and Homeless Youth': 'i',
'Syringe Service Programs': false,
'Naloxone': 't',
'Gotham Pride Health Centers': false,
'3-2-1 Impact': 'v',
'Mental Health Integrated in Primary Care': 'w',
'Child Use of Prescription Pain Relievers or Heroin': 'u'
};
42 changes: 42 additions & 0 deletions config/population.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"id": 6,
"name": "Everyone",
"slug": "everyone"
},
{
"id": 5,
"name": "Children and Youth",
"slug": "children-and-youth"
},
{
"id": 2,
"name": "Families",
"slug": "families"
},
{
"id": 3,
"name": "LGBTQ New Yorkers",
"slug": "lgbtq-new-yorkers"
},
{
"id": 7,
"name": "Immigrants",
"slug": "immigrants"
},
{
"id": 8,
"name": "Adults",
"slug": "adults"
},
{
"id": 4,
"name": "Seniors",
"slug": "seniors"
},
{
"id": 1,
"name": "Veterans",
"slug": "veterans"
}
]
7 changes: 3 additions & 4 deletions config/publish.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

/**
* Config
*/

module.exports = {
'production': 'https://github.com/CityOfNewYork/mhfa',
'development': 'https://github.com/NYCOpportunity/mhfa'
};
development: '',
testing: 'https://github.com/CityOfNewYork/mhfa.git'
};
8 changes: 6 additions & 2 deletions config/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const nodeResolve = require('@rollup/plugin-node-resolve'); // Locate modules us
const replace = require('@rollup/plugin-replace'); // Replace content while bundling.
const vue = require('rollup-plugin-vue'); // Adds .vue file import support
const json = require('@rollup/plugin-json'); // Adds .json file import support

let tokens = require('@nycopportunity/growingup-patterns/config/tokens');
/**
* Base module configuration. Refer to the package for details on the available options.
*
Expand All @@ -30,7 +30,11 @@ const rollup = {
let plugins = [
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'preventAssignment': true
'preventAssignment': true,
'SCREEN_X_LARGE': parseInt(tokens.screens.xlarge),
'SCREEN_LARGE': parseInt(tokens.screens.large),
'SCREEN_MEDIUM': parseInt(tokens.screens.medium),
'SCREEM_SMALL': parseInt(tokens.screens.small)
}),
nodeResolve.nodeResolve({
browser: true,
Expand Down
Loading

0 comments on commit d9a7f5f

Please sign in to comment.