Commit 00f1176a authored by Olivia Madrid's avatar Olivia Madrid

(feat): more docs

1 merge request!4WIP: (feat): document structure of engine, front, and processes
docs/assets/engine-module-diagram.png

186 KB | W: 1539px | H: 942px

docs/assets/engine-module-diagram.png

174 KB | W: 1539px | H: 942px

docs/assets/engine-module-diagram.png
docs/assets/engine-module-diagram.png
docs/assets/engine-module-diagram.png
docs/assets/engine-module-diagram.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -66,24 +66,24 @@ _**Linux users:** To get Elasticsearch 6 to run, you must make a settings change
When things aren't running smoothly in your Dockerized enviroment, sometimes it's best to start from scratch. Follow these steps to **completely delete your data** and start fresh:
```
#Remove your settings file
rm engine/settings.php
#Remove your settings file
rm engine/settings.php
#Stop your stack
docker-compose down
#Stop your stack
docker-compose down
#Delete your data cache
rm -rf .data
#Delete your data cache
rm -rf .data
#Purge all volumes
docker volume prune
#Purge all volumes
docker volume prune
```
After you've deleted your data, you can either rebuild the containers manually by using `docker-compose up --build` or delete them:
```
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
```
## Production system requirements
......
......@@ -3,4 +3,16 @@ id: architecture
title: Architecture
---
> MARK will send diagram sketch
> Mark will send diagram sketch
# Sockets
Sockets are for live interactions, such as comments, group gathering pulsators, notifications, messenger, and the jury.
Note: if you are using Docker, make sure your **JWT secret** maps to the **JWT secret** in `settings.php`. Kubernetes automatically maps it to the helm .yaml file.
```php
$CONFIG->set('sockets-jwt-secret', '{{my-jwt-secret}}');
```
See the [README.md](https://gitlab.com/minds/sockets/blob/master/README.md) of the [Minds Sockets Server](https://gitlab.com/minds/sockets) repository for build instructions.
This diff is collapsed.
......@@ -9,22 +9,22 @@ Minds uses [Angular 8](https://angular.io) for the frontend. Work is currently u
The source code can be found in the [front repository](https://gitlab.com/minds/front).
# Building
## Building
## Development
### Development
From the front repository:
`npm run build-dev`
Keep this running while you are editing so your changes will automatically be reflected when you refresh your browser. Note that this doesn't apply to stylesheet changes - so when you're working with .scss files, you'll need to run `gulp build.sass` before you'll be able to see those changes.
## Production
### Production
_Production build can take up 30 minutes to complete_
`gulp build.sass && sh build/base-locale.sh dist`
# Structure
## Structure
```
front
......@@ -37,19 +37,17 @@ front
└───modules
```
## Common
### Common
> TODO
In most cases, new code will be stored inside subject-specific module folders. However, if you are making something that will be used throughout the site, put it in `/common` so it can be easily accessed from other modules. Some examples of the kind of things that belong in `/common`:
In most cases, new code will be stored inside subject-specific module folders. However, if you are making something that will be used throughout the site, put it in `/common/` so it can be easily accessed from other modules. Some examples of the kind of things that belong in `/common/`:
- **Directives**: user profile hovercard, tooltips, things related to Material design lite (slider, switch, date time picker), etc.
- **Pipes**: ... examples ...
- What else is in here...
# Naming conventions
## Naming conventions
## Component files
### Component files
Components should have `.ts`, `.html` and `.scss` files with the same names.
......@@ -62,7 +60,7 @@ my-cool-module
└───list.component.scss
```
## Elements and classes
### Elements and classes
Minds follows the [BEM](http://getbem.com/naming/) naming conventions for elements and class names, with the `m-` prefix. For example:
......@@ -80,31 +78,31 @@ Minds follows the [BEM](http://getbem.com/naming/) naming conventions for elemen
If you need to add a new class to an older file that has not yet been updated to use BEM conventions, add the new class twice: once with BEM, and again with whatever legacy convention the file is currently using.
## Linting
### Linting
Minds uses [Prettier](https://prettier.io/) to enforce consistent formatting in frontend code.
Before you push your MR, run `prettier --write "src/**/*.{scss,ts,html}"` (or, if possible, download a Prettier plug-in for your code editor and tell it to automatically format the code on save). Defaults are configured in `.prettierrc`.
# Spec tests
## Spec tests
### Executing
#### Executing
`ng test`
### Cypress tests
#### Cypress tests
> TODO: Brian
# Styles
## Styles
## Themes
### Themes
A preset color palette and theme maps are defined in [themes.scss](https://gitlab.com/minds/front/blob/src/stylesheets/themes.scss). The palette contains a range of greys, blue-greys, accent colors, black, white, etc.
A preset color palette and theme maps are defined in [themes.scss](https://gitlab.com/minds/front/blob/master/src/stylesheets/themes.scss). The palette contains a range of greys, blue-greys, accent colors, black, white, etc.
When styling a new component, select colors that are for light theme only. Dark theme inversions will be automatically applied according to the theme map.
### Usage
#### Usage
_All_ colors should be defined using the `m-theme` mixin:
......
......@@ -24,6 +24,8 @@ title: Git / GitLab
For the Minds development team, **branches** are preferred over forks, as they integrate with the **review/sandbox** environments. Community contributors should use forks.
### Branch names
Branch names should be no more that **20 characters** long and include the related issue/epic number. For example, **virtual-reality-chats-7049**.
If you are working on an epic with branches in both front and engine, give both branches identical names to associate them in the sandbox.
......@@ -36,7 +38,7 @@ If the issue is part of an epic, associate them by going to the epic page and ad
## Merge requests
> If your merge request requires changes and isn't ready to be merged yet, add "WIP: " at the beginning of its title. Make sure it does not have the 'MR::Awaiting Merge' label applied.
> If your merge request requires changes and isn't ready to be merged yet, add **WIP:** to the beginning of its title. Make sure it does not have the **MR::Awaiting Merge** label applied.
In the description of your MR, ensure that you:
......@@ -46,11 +48,11 @@ In the description of your MR, ensure that you:
**For example**:
_Allows users to chat in virtual reality. Users must select a checkbox in channel settings in order to opt-in. Users must be logged in and subscribed to one another in order to be eligible. Not enabled for group chats_.\_
_Allows users to chat in virtual reality. Users must select a checkbox in channel settings in order to opt-in. Users must be logged in and subscribed to one another in order to be eligible. Not enabled for group chats._
_To test, try to start a VR chat with/without a VR headset. Make sure you can't engage in a VR chat unless the settings checkbox is checked._
_Closes issue #1749._
_Closes issue #7049._
### Using the staging environment
......
......@@ -3,23 +3,23 @@ id: emails
title: Sending emails
---
# Process overview
## Process overview
1. An event occurs (e.g. a new user joins Minds) and dispatches a message to the queue
2. The queue then dispatches an internal event
3. The internal event compiles and dispatches the email
4. [Mailer.php](https://gitlab.com/minds/engine/blob/Core/Email/Mailer.php) does the actual sending
4. [Mailer.php](https://gitlab.com/minds/engine/blob/master/Core/Email/Mailer.php) does the actual sending
# Email templates
### Email templates
The email itself inherits from [Template.php](https://gitlab.com/minds/engine/blob/Core/Email/Template.php), which builds and outputs the email. We use .tpl files that get wrapped in a general [default.tpl](https://gitlab.com/minds/engine/blob/Components/Email/default.tpl) (which has the headers and footers).
The email itself inherits from [Template.php](https://gitlab.com/minds/engine/blob/master/Core/Email/Template.php), which builds and outputs the email. We use .tpl files that get wrapped in a general [default.tpl](https://gitlab.com/minds/engine/blob/master/Components/Email/default.tpl) (which has the headers and footers).
You can also use/extend optional [EmailStyles.php](https://gitlab.com/minds/engine/blob/Core/Email/EmailStyles.php) and partials (reusable snippets that get built and injected into the email) for additional control over styles. See [SuggestedChannels.php](https://gitlab.com/minds/engine/blob/Core/Email/Partials/SuggestedChannels.php) and
[SuggestedChannels.tpl](https://gitlab.com/minds/engine/blob/Core/Email/Partials/Templates/SuggestedChannels.tpl) for partial usage examples.
You can also use/extend optional [EmailStyles.php](https://gitlab.com/minds/engine/blob/master/Core/Email/EmailStyles.php) and partials (reusable snippets that get built and injected into the email) for additional control over styles. See [SuggestedChannels.php](https://gitlab.com/minds/engine/blob/master/Core/Email/Partials/SuggestedChannels.php) and
[SuggestedChannels.tpl](https://gitlab.com/minds/engine/blob/master/Core/Email/Partials/Templates/SuggestedChannels.tpl) for partial usage examples.
# Testing
### Testing
See email-related [CLI controllers](https://gitlab.com/minds/engine/blob/Controllers/Cli/Email.php) for tools related to testing and building.
See email-related [CLI controllers](https://gitlab.com/minds/engine/blob/master/Controllers/Cli/Email.php) for tools related to testing and building.
To actually send and test, add your own SMTP server to `settings.php`:
......@@ -27,8 +27,8 @@ To actually send and test, add your own SMTP server to `settings.php`:
$CONFIG->set('email', [
'smtp' => [
'host' => 'smtp.gmail.com',
'username' => 'your username',
'password' => 'your password',
'username' => 'my username',
'password' => 'my password',
'port' => 465
]
]);
......
---
id: feature-flags
title: Feature Flags
title: Feature flags
---
Feature flags allow new features to be introduced to a subset of users (i.e. those in Canary mode) before they are available to all users. Do this by enabling a feature flag and then wrapping a gate around code that you want to be executed for applicable users.
......
......@@ -3,7 +3,7 @@ id: notifications
title: Notifications
---
# Backend events and settings
## Backend events and settings
Let's say we want to create a notification to send to video chat participants after a chat has completed.
......@@ -19,15 +19,13 @@ $this->dispatcher->trigger('notification', 'all', [
]);
```
Add your `notification_view` to [PushSettings.php](https://gitlab.com/minds/engine/blob/Core/Notification/Settings/PushSettings.php):
Add your `notification_view` to [PushSettings.php](https://gitlab.com/minds/engine/blob/master/Core/Notification/Settings/PushSettings.php):
```php
class PushSettings
{
protected $types = [
...
'videochat_complete' => true,
];
......@@ -35,14 +33,14 @@ protected $types = [
Also add your `notification_view` to:
- [Notification/Manager.php](https://gitlab.com/minds/engine/blob/Core/Notification/Manager.php) to determine which notification category it belongs to (e.g boosts, subscriptions, votes, etc.)
- [Notification/Extensions/Push.php](https://gitlab.com/minds/engine/blob/Core/Notification/Extensions/Push.php)
- [Notification/Manager.php](https://gitlab.com/minds/engine/blob/master/Core/Notification/Manager.php) to determine which notification category it belongs to (e.g boosts, subscriptions, votes, etc.)
- [Notification/Extensions/Push.php](https://gitlab.com/minds/engine/blob/master/Core/Notification/Extensions/Push.php)
> TODO: What is Push.php? and should referrals be in there?
# Frontend template
## Frontend template
Set up the template in [notification.component.html](https://gitlab.com/minds/front/blob/src/app/modules/notifications/notification.component.html):
Set up the template in [notification.component.html](https://gitlab.com/minds/front/blob/master/src/app/modules/notifications/notification.component.html):
```html
<ng-template ngSwitchCase="videochat_complete">
......@@ -50,7 +48,7 @@ Set up the template in [notification.component.html](https://gitlab.com/minds/fr
</ng-template>
```
# Testing
## Testing
Make sure the notification dispatcher runner is running:
......
......@@ -33,14 +33,23 @@
"guides/git": {
"title": "Git / GitLab"
},
"guides/kubernetes": {
"title": "Kubernetes"
},
"guides/mobile": {
"title": "Mobile"
},
"reference/glossary": {
"title": "Glossary / Examples"
"walk-throughs/cookies": {
"title": "Cookies"
},
"walk-throughs/emails": {
"title": "Sending emails"
},
"walk-throughs/feature-flags": {
"title": "Feature Flags"
},
"walk-throughs/infinite-scroll": {
"title": "Infinite scroll"
},
"walk-throughs/notifications": {
"title": "Notifications"
}
},
"links": {
......@@ -51,7 +60,8 @@
"categories": {
"Getting Started": "Getting Started",
"Guides": "Guides",
"Contributing": "Contributing"
"Contributing": "Contributing",
"Walk-throughs": "Walk-throughs"
}
},
"pages-strings": {
......
......@@ -16,8 +16,8 @@ const users = [
// if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/bulb.svg',
infoLink: 'https://www.minds.com',
pinned: true,
},
pinned: true
}
];
const siteConfig = {
......@@ -29,19 +29,20 @@ const siteConfig = {
// Used for publishing and more
projectName: 'Minds Docs',
organizationName: 'Minds',
editUrl: 'https://gitlab.com/minds/docs/blob/master/docs/',
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'getting-started/introduction', label: 'Docs'},
{ doc: 'getting-started/introduction', label: 'Docs' },
//{doc: 'doc4', label: 'API'},
{
label: 'Code',
href: "https://gitlab.com/minds",
href: 'https://gitlab.com/minds'
},
{
label: 'Minds.com',
href: "https://minds.com/",
},
href: 'https://minds.com/'
}
],
// If you have users set above, you add it here:
......@@ -55,7 +56,7 @@ const siteConfig = {
/* Colors for website */
colors: {
primaryColor: '#FFF',
secondaryColor: '#FFF',
secondaryColor: '#FFF'
},
/* Custom fonts for website */
......@@ -77,11 +78,16 @@ const siteConfig = {
highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks.
theme: 'default',
theme: 'default'
},
// Add custom scripts here that would be placed in <script> tags.
scripts: ['https://buttons.github.io/buttons.js'],
scripts: [
'https://buttons.github.io/buttons.js',
'https://buttons.github.io/buttons.js',
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
'/js/code-block-buttons.js'
],
// On page navigation for the current documentation page.
onPageNav: 'separate',
......@@ -96,13 +102,13 @@ const siteConfig = {
// enableUpdateBy: true,
// Show documentation's last update time.
// enableUpdateTime: true,
enableUpdateTime: true,
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
// repoUrl: 'https://github.com/facebook/test-site',
customDocsPath: './docs',
customDocsPath: './docs'
};
module.exports = siteConfig;
/* "Copy" code block button */
pre {
position: relative;
}
pre .btnIcon {
position: absolute;
top: 4px;
z-index: 2;
cursor: pointer;
border: 1px solid transparent;
padding: 0;
color: #999;
background-color: transparent;
height: 30px;
transition: all 0.25s ease-out;
}
pre .btnIcon:hover {
text-decoration: none;
color: #777;
}
.btnIcon__body {
align-items: center;
display: flex;
}
.btnIcon svg {
fill: currentColor;
margin-right: 0.4em;
}
.btnIcon__label {
font-size: 11px;
}
.btnClipboard {
right: 10px;
}
// Turn off ESLint for this file because it's sent down to users as-is.
/* eslint-disable */
window.addEventListener('load', function() {
function button(label, ariaLabel, icon, className) {
const btn = document.createElement('button');
btn.classList.add('btnIcon', className);
btn.setAttribute('type', 'button');
btn.setAttribute('aria-label', ariaLabel);
btn.innerHTML =
'<div class="btnIcon__body">' +
icon +
'<strong class="btnIcon__label">' +
label +
'</strong>' +
'</div>';
return btn;
}
function addButtons(codeBlockSelector, btn) {
document.querySelectorAll(codeBlockSelector).forEach(function(code) {
code.parentNode.appendChild(btn.cloneNode(true));
});
}
const copyIcon =
'<svg width="12" height="12" viewBox="340 364 14 15" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M342 375.974h4v.998h-4v-.998zm5-5.987h-5v.998h5v-.998zm2 2.994v-1.995l-3 2.993 3 2.994v-1.996h5v-1.995h-5zm-4.5-.997H342v.998h2.5v-.997zm-2.5 2.993h2.5v-.998H342v.998zm9 .998h1v1.996c-.016.28-.11.514-.297.702-.187.187-.422.28-.703.296h-10c-.547 0-1-.452-1-.998v-10.976c0-.546.453-.998 1-.998h3c0-1.107.89-1.996 2-1.996 1.11 0 2 .89 2 1.996h3c.547 0 1 .452 1 .998v4.99h-1v-2.995h-10v8.98h10v-1.996zm-9-7.983h8c0-.544-.453-.996-1-.996h-1c-.547 0-1-.453-1-.998 0-.546-.453-.998-1-.998-.547 0-1 .452-1 .998 0 .545-.453.998-1 .998h-1c-.547 0-1 .452-1 .997z" fill-rule="evenodd"/></svg>';
addButtons(
'.hljs',
button('Copy', 'Copy code to clipboard', copyIcon, 'btnClipboard')
);
const clipboard = new ClipboardJS('.btnClipboard', {
target: function(trigger) {
return trigger.parentNode.querySelector('code');
}
});
clipboard.on('success', function(event) {
event.clearSelection();
const textEl = event.trigger.querySelector('.btnIcon__label');
textEl.textContent = 'Copied';
setTimeout(function() {
textEl.textContent = 'Copy';
}, 2000);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment