style: finally clean directory structure

This commit is contained in:
hippoz 2021-10-04 22:04:40 +03:00
parent 47ef5dd6fc
commit 2b929bfd15
No known key found for this signature in database
GPG key ID: 7C52899193467641
54 changed files with 669 additions and 807 deletions

View file

@ -1,14 +0,0 @@
kind: pipeline
type: docker
name: default
platform:
os: linux
arch: arm64
steps:
- name: build
image: node
commands:
- cd bfrontend
- npm build

136
.gitignore vendored
View file

@ -1,118 +1,24 @@
# ---> Node # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Logs
logs # dependencies
*.log /node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.eslintcache
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

View file

@ -1,5 +1,3 @@
![Logo](https://provider.hippoz.xyz/arctic/Logo.svg) # waffle-react
# brainlet-react a react frontend for waffle
a react frontend for brainlet

23
bfrontend/.gitignore vendored
View file

@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View file

@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

View file

@ -1,44 +0,0 @@
import ContentLoader from "react-content-loader"
import { useMediaPredicate } from "react-media-hook";
export default function ChannelListLoader(props) {
const lessThan600 = useMediaPredicate("(max-width: 600px)");
if (lessThan600) {
return (
<ContentLoader
speed={1.5}
width={100}
height={250}
viewBox="0 0 100 250"
backgroundColor="#22232b"
foregroundColor="#282a33"
{...props}
>
<rect x="10" y="10" rx="10" ry="10" width="100" height="40" />
<rect x="10" y="55" rx="10" ry="10" width="100" height="40" />
<rect x="10" y="100" rx="10" ry="10" width="100" height="40" />
<rect x="10" y="145" rx="10" ry="10" width="100" height="40" />
<rect x="10" y="190" rx="10" ry="10" width="100" height="40" />
</ContentLoader>
);
} else {
return (
<ContentLoader
speed={1.5}
width={200}
height={250}
viewBox="0 0 200 250"
backgroundColor="#22232b"
foregroundColor="#282a33"
{...props}
>
<rect x="10" y="10" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="55" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="145" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="100" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="190" rx="10" ry="10" width="180" height="40" />
</ContentLoader>
);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,8 @@
{ {
"name": "bfrontend", "name": "waffle-react",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": false,
"dependencies": { "dependencies": {
"@primer/octicons-react": "^15.1.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-content-loader": "^6.0.3", "react-content-loader": "^6.0.3",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
@ -22,8 +21,7 @@
"proxy": "http://localhost:3005", "proxy": "http://localhost:3005",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app"
"react-app/jest"
] ]
}, },
"browserslist": { "browserslist": {

View file

@ -6,7 +6,7 @@
<title>app</title> <title>app</title>
</head> </head>
<body> <body>
<noscript>Sorry, but JavaScript is required to use this app.</noscript> <noscript>Sorry, but JavaScript is required.</noscript>
<div id="root"></div> <div id="root"></div>
</body> </body>

View file

@ -1,6 +1,6 @@
import Logger from '../Util/Logger'; import Logger from '../common/util/Logger';
import gateway from "./Gateway/globalGatewayConnection"; import gateway from "./gateway/globalGatewayConnection";
import token from "./TokenManager"; import token from "./tokenManager";
const { log: authLog } = Logger([ 'Authenticator' ]); const { log: authLog } = Logger([ 'Authenticator' ]);

View file

@ -1,4 +1,4 @@
import logger from "../../Util/Logger"; import logger from "../../common/util/Logger";
const { log: logGateway } = logger([ "Gateway" ]); const { log: logGateway } = logger([ "Gateway" ]);
const { log: logRtc } = logger([ "Gateway", "RTC" ]); const { log: logRtc } = logger([ "Gateway", "RTC" ]);

View file

@ -1,7 +1,7 @@
import GatewayConnection from './GatewayConnection'; import GatewayConnection from './GatewayConnection';
import config from '../../Config'; import config from '../../config';
import store from '../../Global/store'; import store from '../../common/store';
import logger from '../../Util/Logger'; import logger from '../../common/util/Logger';
const { log } = logger(["globalGatewayConnection"]); const { log } = logger(["globalGatewayConnection"]);
const { warn: experimentsWarn } = logger(["globalGatewayConnection", "Experiments"]); const { warn: experimentsWarn } = logger(["globalGatewayConnection", "Experiments"]);

View file

@ -1,5 +1,5 @@
import config from '../Config'; import config from '../config';
import token from "./TokenManager"; import token from "./tokenManager";
async function APIRequest(endpoint, options) { async function APIRequest(endpoint, options) {
let res; let res;

View file

@ -1,6 +1,6 @@
const Auth = { const tokenManager = {
getToken: () => localStorage.getItem("token"), getToken: () => localStorage.getItem("token"),
setToken: (token) => localStorage.setItem("token", token) setToken: (token) => localStorage.setItem("token", token)
}; };
export default Auth; export default tokenManager;

View file

@ -1,4 +1,4 @@
import UserProfileLink from '../Users/UserProfileLink'; import UserProfileLink from './user/UserProfileLink';
export default function Message({ message, hideUsername }) { export default function Message({ message, hideUsername }) {
return ( return (

View file

@ -1,6 +1,6 @@
import ChannelList from '../Channels/ChannelList'; import ChannelList from './channel/ChannelList';
import UserProfileLink from '../Users/UserProfileLink'; import UserProfileLink from './user/UserProfileLink';
import ProfileLinkLoader from "../UI/ProfileLinkLoader"; import ProfileLinkLoader from "./ProfileLinkLoader";
import { connect } from 'react-redux'; import { connect } from 'react-redux';

View file

@ -1,9 +1,9 @@
import { useState } from 'react'; import { useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import Notification from '../UI/Notification'; import Notification from '../Notification';
import APIRequest from '../../API/APIRequest'; import APIRequest from '../../api/request';
import { getSignupMessageFromError } from '../../Util/Errors' import { getSignupMessageFromError } from '../../common/util/Errors'
export default function Create() { export default function Create() {
const history = useHistory(); const history = useHistory();

View file

@ -1,11 +1,11 @@
import { useState } from 'react'; import { useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import Notification from '../UI/Notification'; import Notification from '../Notification';
import APIRequest from '../../API/APIRequest'; import APIRequest from '../../api/request';
import Authenticator from '../../API/Authenticator'; import Authenticator from '../../api/authenticator';
import token from "../../API/TokenManager"; import token from "../../api/tokenManager";
import { getLoginMessageFromError } from '../../Util/Errors' import { getLoginMessageFromError } from '../../common/util/Errors'
export default function Login() { export default function Login() {
const history = useHistory(); const history = useHistory();

View file

@ -1,5 +1,5 @@
import ChannelProfile from './ChannelProfileLink'; import ChannelProfile from './ChannelProfileLink';
import gatewayConnection from '../../API/Gateway/globalGatewayConnection'; import gatewayConnection from '../../api/gateway/globalGatewayConnection';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';

View file

@ -0,0 +1,21 @@
import ContentLoader from "react-content-loader"
export default function ChannelListLoader(props) {
return (
<ContentLoader
speed={1.5}
width={200}
height={250}
viewBox="0 0 200 250"
backgroundColor="#22232b"
foregroundColor="#282a33"
{...props}
>
<rect x="10" y="10" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="55" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="145" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="100" rx="10" ry="10" width="180" height="40" />
<rect x="10" y="190" rx="10" ry="10" width="180" height="40" />
</ContentLoader>
);
}

View file

@ -1,6 +1,5 @@
import Message from "../Messages/Message"; import Message from "../Message";
import { useRef, useEffect } from 'react'; import { useRef, useEffect } from 'react';
import { CommentDiscussionIcon } from "@primer/octicons-react";
export default function ChannelMessageView({messages}) { export default function ChannelMessageView({messages}) {
const invisibleBottomMessageRef = useRef(); const invisibleBottomMessageRef = useRef();
@ -12,7 +11,6 @@ export default function ChannelMessageView({messages}) {
let messagesView = messages.map((message) => (<Message key={message._id} message={message} />)); let messagesView = messages.map((message) => (<Message key={message._id} message={message} />));
if (messagesView === undefined || messagesView.length <= 0) if (messagesView === undefined || messagesView.length <= 0)
messagesView = (<div className='no-messages-warning'> messagesView = (<div className='no-messages-warning'>
<CommentDiscussionIcon size={64} />
<span style={{ margin: "12px" }}>No messages yet...</span> <span style={{ margin: "12px" }}>No messages yet...</span>
</div>); </div>);

View file

@ -1,5 +1,5 @@
import UserProfileButton from '../Users/UserButton'; import UserProfileButton from '../user/UserButton';
import ProfileLinkLoader from "../UI/ProfileLinkLoader"; import ProfileLinkLoader from "../ProfileLinkLoader";
function ChannelUserList({ presence }) { function ChannelUserList({ presence }) {
if (!presence || presence.length === 0) return ( if (!presence || presence.length === 0) return (

View file

@ -1,7 +1,7 @@
import ChannelProfile from './ChannelProfileLink'; import ChannelProfile from './ChannelProfileLink';
import gatewayConnection from '../../API/Gateway/globalGatewayConnection'; import gatewayConnection from '../../api/gateway/globalGatewayConnection';
import ChannelUserList from "./ChannelUserList"; import ChannelUserList from "./ChannelUserList";
import ProfileLinkLoader from "../UI/ProfileLinkLoader"; import ProfileLinkLoader from "../ProfileLinkLoader";
import { connect, useDispatch } from 'react-redux'; import { connect, useDispatch } from 'react-redux';
import { useState, useRef, useEffect } from 'react'; import { useState, useRef, useEffect } from 'react';

View file

@ -1,15 +1,15 @@
import Login from '../Auth/Login';
import Create from '../Auth/Create';
import Root from '../Home/Root';
import Authenticator from '../../API/Authenticator';
import Notification from '../UI/Notification';
import './../../Styles/App.scss';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { BrowserRouter, Switch, Route } from 'react-router-dom'; import { BrowserRouter, Switch, Route } from 'react-router-dom';
import Login from '../auth/Login';
import Create from '../auth/Create';
import Root from '../main/Root';
import Authenticator from '../../api/authenticator';
import Notification from '../Notification';
import './../../styles/App.scss';
import LoggedInMount from './LoggedInMount'; import LoggedInMount from './LoggedInMount';
import FullMessage from '../UI/FullMessage'; import FullMessage from '../FullMessage';
function App({ user, fullscreenMessage }) { function App({ user, fullscreenMessage }) {
const [ notificationText ] = useState(''); const [ notificationText ] = useState('');

View file

@ -1,8 +1,8 @@
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import Sidebar from "../UI/Sidebar"; import Sidebar from "../Sidebar";
import ChannelView from "../Channels/ChannelView"; import ChannelView from "../channel/ChannelView";
import GradientBanner from "../UI/GradientBanner"; import GradientBanner from "../GradientBanner";
import UserView from "../Users/UserView"; import UserView from "../user/UserView";
import { connect } from "react-redux"; import { connect } from "react-redux";
function LoggedInMount({ gradientBannerNotificationText }) { function LoggedInMount({ gradientBannerNotificationText }) {

View file

@ -1,8 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { PersonIcon, ShieldCheckIcon } from "@primer/octicons-react"; import APIRequest from "../../api/request";
import APIRequest from "../../API/APIRequest";
import UserProfile from "./UserProfileLink"; import UserProfile from "./UserProfileLink";
import ProfileLinkLoader from "../UI/ProfileLinkLoader"; import ProfileLinkLoader from "../ProfileLinkLoader";
export default function UserView({ userId }) { export default function UserView({ userId }) {
const [userObject, setUserObject] = useState(null); const [userObject, setUserObject] = useState(null);
@ -24,8 +23,8 @@ export default function UserView({ userId }) {
if (userObject) { if (userObject) {
view = <> view = <>
<UserProfile user={ userObject } size="32" /> <UserProfile user={ userObject } size="32" />
{(userObject.role === "ADMIN") && <ShieldCheckIcon size={24} className="profile-badge" />} {(userObject.role === "ADMIN") && <span>Admin</span>}
{(userObject.role === "USER") && <PersonIcon size={24} className="profile-badge" />} {(userObject.role === "USER") && <span>User</span>}
</> </>
} else { } else {
view = <> view = <>

View file

@ -1,5 +1,5 @@
import store from './Global/store'; import store from './common/store';
import App from './Components/Main/App'; import App from './components/main/App';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';