Skip to content

Commit

Permalink
copied package
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenkux committed Nov 29, 2023
1 parent 0ce5fc6 commit 5d4e7e8
Show file tree
Hide file tree
Showing 26 changed files with 651 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/messenger-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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*
.env
9 changes: 9 additions & 0 deletions packages/messenger-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN apk add --update python3 make g++\
&& rm -rf /var/cache/apk/*
RUN yarn install
RUN yarn build
CMD yarn workspace messenger-demo start
EXPOSE 3000
23 changes: 23 additions & 0 deletions packages/messenger-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dm3-web

## Getting Started

### Build

```
cd ../../ && yarn build
```

### Usage

yarn:

```
yarn start
```

npm:

```
yarn start
```
43 changes: 43 additions & 0 deletions packages/messenger-web/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const webpack = require('webpack');
module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
assert: require.resolve('assert'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify'),
url: require.resolve('url'),
path: require.resolve('path-browserify'),
});
config.module.rules.push({
test: /\.(js|mjs|jsx)$/,
enforce: 'pre',
loader: require.resolve('source-map-loader'),
resolve: {
fullySpecified: false,
},
});
config.resolve.fallback = fallback;

config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
]);

config.module.rules = config.module.rules.map((rule) => {
if (rule.oneOf instanceof Array) {
rule.oneOf[rule.oneOf.length - 1].exclude = [
/\.(js|mjs|jsx|cjs|ts|tsx)$/,
/\.html$/,
/\.json$/,
];
}
return rule;
});

return config;
};
66 changes: 66 additions & 0 deletions packages/messenger-web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "messenger-web",
"version": "0.1.0",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.11.41",
"@types/react": "^18.0.13",
"@types/react-dom": "^18.0.5",
"autoprefixer": "10.4.5",
"bootstrap": "^5.1.3",
"express": "^4.18.2",
"messenger-widget": "workspace:^",
"postcss": "^8.4.24",
"react-dom": "^18.2.0",
"typescript": "^4.7.3",
"web-vitals": "^2.1.4"
},
"scripts": {
"start:dev": "react-app-rewired start",
"start": "node server.js",
"build": "react-app-rewired build",
"test": "echo 'no tests'",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
"chrome >= 67",
"edge >= 79",
"firefox >= 68",
"opera >= 54",
"safari >= 14"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/dom": "^9.3.1",
"@types/three": "^0.141.0",
"add": "^2.0.6",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"react-app-rewired": "^2.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.0",
"yarn": "^1.22.19"
}
}
Binary file added packages/messenger-web/public/dark-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/messenger-web/public/dm3-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/messenger-web/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions packages/messenger-web/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />

<link rel="icon" href="%PUBLIC_URL%/favicon.png" type="image/svg+xml" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="dm3"
content="dm3 enables decentralized, open, and secure messaging using established web3 services"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>dm3</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
--></body>
</html>
8 changes: 8 additions & 0 deletions packages/messenger-web/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"short_name": "dm3",
"name": "dm3 enables decentralized, open, and secure messaging using established web3 services",
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#000000"
}
3 changes: 3 additions & 0 deletions packages/messenger-web/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
9 changes: 9 additions & 0 deletions packages/messenger-web/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;

app.use(express.static('build'));

app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});
4 changes: 4 additions & 0 deletions packages/messenger-web/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
background-color: #000000;
overflow: hidden;
}
28 changes: 28 additions & 0 deletions packages/messenger-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Import CSS and JS from Bootstrap
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';

// Import the global CSS file
import './App.css';

// Import the components
import Background from './Background';
import Dm3Widget from './Dm3Widget';
import Footer from './Footer';
import Header from './Header';

// The main component of the application
function App() {
// The components are rendered in the order they should appear
return (
<div className="App">
<Background />
<Header />
<Footer />
<Dm3Widget />
</div>
);
}

// Export the App component as the default export
export default App;
Loading

0 comments on commit 5d4e7e8

Please sign in to comment.