Skip to content

Commit

Permalink
feat: init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ComfortablyCoding committed Feb 14, 2022
0 parents commit f0b45b6
Show file tree
Hide file tree
Showing 42 changed files with 2,456 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = false
indent_style = tab
indent_size = 2
8 changes: 8 additions & 0 deletions .eslintrc.backend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
$schema: 'https://json.schemastore.org/eslintrc',
env: {
es6: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:node/recommended', 'prettier'],
};
26 changes: 26 additions & 0 deletions .eslintrc.frontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
$schema: 'https://json.schemastore.org/eslintrc',
parser: '@babel/eslint-parser',
env: {
browser: true,
es6: true,
},
plugins: ['react'],
extends: ['eslint:recommended', 'plugin:react/recommended', 'prettier'],
parserOptions: {
requireConfigFile: false,
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
babelOptions: {
presets: ['@babel/preset-react'],
},
},
settings: {
react: {
version: 'detect',
},
},
};
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const frontendESLint = require('./.eslintrc.frontend.js');
const backendESLint = require('./.eslintrc.backend.js');

module.exports = {
$schema: 'https://json.schemastore.org/eslintrc',
parserOptions: {
ecmaVersion: 2018,
},
rules: {
indent: ['error', 'tab'],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
},
globals: {
strapi: 'readonly',
},
overrides: [
{
files: ['server/**/*'],
...backendESLint,
},
{
files: ['admin/**/*'],
...frontendESLint,
},
],
};
99 changes: 99 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes

# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#

#
## These files are text and should be normalized (Convert crlf => lf)
#

# source code
*.php text
*.css text
*.sass text
*.scss text
*.less text
*.styl text
*.js text eol=lf
*.coffee text
*.json text
*.htm text
*.html text
*.xml text
*.svg text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
*.sh text
*.bat text

# templates
*.ejs text
*.hbt text
*.jade text
*.haml text
*.hbs text
*.dot text
*.tmpl text
*.phtml text

# git config
.gitattributes text
.gitignore text
.gitconfig text

# code analysis config
.jshintrc text
.jscsrc text
.jshintignore text
.csslintrc text

# misc config
*.yaml text
*.yml text
.editorconfig text

# build config
*.npmignore text
*.bowerrc text

# Documentation
*.md text
LICENSE text
AUTHORS text


#
## These files are binary and should be left untouched
#

# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary
31 changes: 31 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will publish a package to NPM when a release is created

name: Publish to NPM

on:
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2

- name: Install Node v14
uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
run: npm install -g yarn

- name: Clean install deps
run: yarn install --frozen-lockfile

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Don't check auto-generated stuff into git
coverage
node_modules
stats.json

# Cruft
.DS_Store
npm-debug.log
.idea
22 changes: 22 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# npm
npm-debug.log

# git
.git
.gitattributes
.gitignore

# vscode
.vscode

# RC files
.eslintrc.js
.eslintrc.backend.js
.eslintrc.frontend.js
.prettierrc.json

# config files
.editorconfig

# github
.github
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock.json
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"useTabs": true,
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 100
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 @ComfortablyCoding

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# strapi-plugin-notes

A plugin for [Strapi](https://github.com/strapi/strapi) that provides the ability to add notes to entity records.

## Requirements

The installation requirements are the same as Strapi itself and can be found in the documentation on the [Quick Start](https://strapi.io/documentation/developer-docs/latest/getting-started/quick-start.html) page in the Prerequisites info card.

### Supported Strapi versions

- v4.x.x

**NOTE**: While this plugin may work with the older Strapi versions, they are not supported, it is always recommended to use the latest version of Strapi.

## Installation

```sh
npm install strapi-plugin-notes
```

**or**

```sh
yarn add strapi-plugin-notes
```

## Configuration

The plugin configuration is stored in a config file located at `./config/plugins.js`.

```javascript
module.exports = ({ env }) => ({
'entity-notes': {
enabled: true,
},
});
```

**IMPORTANT NOTE**: Make sure any sensitive data is stored in env files.

## Usage

Once the plugin has been installed, configured a notes section will be added to the `informations` sections of the edit view for all content types.

### Adding a note

Navigate to the entity record that a note needs to be added to and click the `Add new note` text button. A modal will appear with input areas to add the note information. Once completed select save to create the note. Clicking the `x` icon on the top right or cancel on the bottom left will abort the note creation.

### Editing a note

Navigate to the entity record that the note belongs to, and find the note in the notes list. Click on the pen can icon and a modal will appear with input areas to add the note information. Once completed select save to permanently save any changes that have been made. Clicking the `x` icon on the top right or cancel on the bottom left will abort all edits.

### Deleting a note

Navigate to the entity record that the note belongs to, and find the note in the notes list. Click on the trash can icon and the record will be deleted.

## Bugs

If any bugs are found please report them as a [Github Issue](https://github.com/ComfortablyCoding/strapi-plugin-notes/issues)
26 changes: 26 additions & 0 deletions admin/src/components/Initializer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
*
* Initializer
*
*/

import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { pluginId } from '../../pluginId';

const Initializer = ({ setPlugin }) => {
const ref = useRef();
ref.current = setPlugin;

useEffect(() => {
ref.current(pluginId);
}, []);

return null;
};

Initializer.propTypes = {
setPlugin: PropTypes.func.isRequired,
};

export default Initializer;
Loading

0 comments on commit f0b45b6

Please sign in to comment.