diff --git a/README.md b/README.md index 9c40dcd..9058241 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,77 @@ -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +# Dashboard -## Available Scripts +[screenshot]: ./screenshot.png -In the project directory, you can run: -### `yarn start` +Dashboard is just that - a dashboard. It's inspired by [SUI](https://github.com/jeroenpardon/sui) and has all the same features as SUI. -Runs the app in the development mode.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +## Installation +Getting Dashboard to run is fairly simple: -The page will reload if you make edits.
-You will also see any lint errors in the console. + git clone https://github.com/phntxx/dashboard.git + cd dashboard + yarn + yarn start -### `yarn test` +Alternatively, if you want to get static files, simply run: -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. + git clone https://github.com/phntxx/dashboard.git + cd dashboard + yarn + yarn build +and then put the files in the build-folder onto your web server. +## Customization +Dashboard is designed to be customizable. Everything is handled using four .json-files, which can be found at /src/components/data -### `yarn build` +### Applications +To add an application, append the following to applications.json or simply edit one of the examples given. -Builds the app for production to the `build` folder.
-It correctly bundles React in production mode and optimizes the build for the best performance. +``` + { + "name": "[Name of the Application]", + "displayURL": "[URL you want to show]", + "URL": "[URL to redirect to]", + "icon": "[Icon code]" + } + ... +``` -The build is minified and the filenames include the hashes.
-Your app is ready to be deployed! + To find icons, simply go to the [Material Design Icon Library](https://material.io/icons/) and copy one of the codes for an icon there. -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. +### Bookmarks -### `yarn eject` +To add an bookmark, append the following to bookmarks.json or simply edit one of the examples given. -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** +``` + { + "name": "[Category name]", + "items": [ + { + "name": "[Bookmark name]", + "url": "[URL to redirect to]" + }, + { + "name": "[Bookmark name]", + "url": "[URL to redirect to]" + }, + { + "name": "[Bookmark name]", + "url": "[URL to redirect to]" + } + ... + ] + }, +``` -If you aren’t 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. +### Theming: +Dashboard also supports themes with the help of a simple JSON-file: themes.json. To add a theme, append the following to themes.json: -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 you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t 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 - -### Analyzing the Bundle Size - -This section has moved here: 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 - -### Advanced Configuration - -This section has moved here: 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 - -### `yarn build` fails to minify - -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify +``` + { + "label": "[Theme Name]", + "value": [Number of the theme], + "mainColor": "[Main Color as 6-character hex code]", + "accentColor": "[Accent Color as 6-character hex code]", + "backgroundColor": "[Background Color as 6-character hex code]" + } +``` diff --git a/package.json b/package.json index 783b477..02ad091 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,12 @@ "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", + "material-icons-react": "^1.0.4", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-scripts": "3.4.1" + "react-scripts": "3.4.1", + "react-select": "^3.1.0", + "styled-components": "^5.1.0" }, "scripts": { "start": "react-scripts start", diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index bcd5dfd..0000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/index.html b/public/index.html index aa069f2..7c98d0a 100644 --- a/public/index.html +++ b/public/index.html @@ -2,42 +2,16 @@ - - - - - - - React App + + Dashboard
- diff --git a/public/logo192.png b/public/logo192.png deleted file mode 100644 index fc44b0a..0000000 Binary files a/public/logo192.png and /dev/null differ diff --git a/public/logo512.png b/public/logo512.png deleted file mode 100644 index a4e47a6..0000000 Binary files a/public/logo512.png and /dev/null differ diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index 080d6c7..0000000 --- a/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "short_name": "React App", - "name": "Create React App Sample", - "icons": [ - { - "src": "favicon.ico", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..dd0f3ba Binary files /dev/null and b/screenshot.png differ diff --git a/src/App.css b/src/App.css deleted file mode 100644 index 74b5e05..0000000 --- a/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/src/App.js b/src/App.js index ce9cbd2..1338a35 100644 --- a/src/App.js +++ b/src/App.js @@ -1,26 +1,38 @@ import React from 'react'; -import logo from './logo.svg'; -import './App.css'; +import styled, { createGlobalStyle } from 'styled-components'; -function App() { - return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); -} +import SearchBar from './components/searchBar' +import Greeter from './components/greeter' +import AppList from './components/appList' +import BookmarkList from './components/bookmarkList' +import SettingsModal from './components/settingsModal' + +import themeData from './components/data/themes.json'; +const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0]; + +const GlobalStyle = createGlobalStyle` + body { + background-color: ${selectedTheme.backgroundColor}; + } +`; + +const AppContainer = styled.div` + max-width: 80%; + margin: auto; + padding: 10px; +`; + +const App = () => ( + <> + + + + + + + + + +); export default App; diff --git a/src/App.test.js b/src/App.test.js deleted file mode 100644 index 4db7ebc..0000000 --- a/src/App.test.js +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import { render } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - const { getByText } = render(); - const linkElement = getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/src/components/appList.js b/src/components/appList.js new file mode 100644 index 0000000..694dce6 --- /dev/null +++ b/src/components/appList.js @@ -0,0 +1,93 @@ +import React from 'react'; +import MaterialIcon from 'material-icons-react'; +import styled from 'styled-components'; + +import appData from './data/apps.json'; + +import themeData from './data/themes.json' +const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0]; + +const AppListContainer = styled.div` + padding: 2rem 0 2rem 0; +`; + +const AppsContainer = styled.div` + display: flex; + flex-direction: row; + flex-wrap: wrap; + + @media (max-width: 600px) { + flex-direction: column; + } +`; + +const AppContainer = styled.div` + display: flex; + flex-direction: row; + flex: 1 0 21%; + padding: 1rem 0 1rem 0; + + @media (max-width: 750px) { + flex: 1 0 42%; + } +`; + +const IconContainer = styled.div` + margin-right: 5px; +`; + +const AppDetails = styled.div` + display: flex; + flex-direction: column; +`; + +const ApplicationsText = styled.h3` + font-family: Roboto, sans-serif; + font-weight: 900; + text-transform: uppercase; + margin: 0px; + font-size: 20px; + color: ${selectedTheme.mainColor}; +`; + +const Link = styled.a` + font-family: Roboto, sans-serif; + color: ${selectedTheme.mainColor}; + font-weight: 500; + text-transform: uppercase; + margin: 0px; + text-decoration: none; + font-size: 15px; +`; + +const Description = styled.p` + font-family: Roboto, sans-serif; + text-transform: uppercase; + margin: 0px; + font-size: 10px; + font-weight: 400; + color: ${selectedTheme.accentColor}; +`; + +const appList = () => ( + + Applications + + { + appData.apps.map((app) => ( + + + + + + {app.name} + {app.displayURL} + + + )) + } + + +); + +export default appList; \ No newline at end of file diff --git a/src/components/bookmarkList.js b/src/components/bookmarkList.js new file mode 100644 index 0000000..47aaa23 --- /dev/null +++ b/src/components/bookmarkList.js @@ -0,0 +1,79 @@ +import React from 'react'; +import styled from 'styled-components'; + +import bookmarkData from './data/bookmarks.json'; + +import themeData from './data/themes.json' +const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0]; + +const BookmarksText = styled.h3` + font-family: Roboto, sans-serif; + text-transform: uppercase; + margin: 0; + font-size: 20px; + color: ${selectedTheme.mainColor}; +`; + +const GroupText = styled.h4` + font-family: Roboto, sans-serif; + font-weight: 700; + margin: 0; + text-transform: uppercase; + color: ${selectedTheme.mainColor}; +`; + +const BookmarkListContainer = styled.div` + padding: 2rem 0 2rem 0; +`; + +const BookmarksContainer = styled.div` + display: flex; + flex-direction: row; + flex-wrap: wrap; + width: 100%; + + @media (max-width: 600px) { + flex-direction: column; + } +`; + +const BookmarkGroupContainer = styled.div` + display: flex; + flex-direction: column; + flex: 1 0 21%; + padding-top: 2rem; + font-size: 15px; +`; + +const Bookmark = styled.a` + font-family: Roboto, sans-serif; + font-weight: 400; + text-decoration: none; + color: ${selectedTheme.accentColor}; + padding: 10px 0 0 0; + font-size: 14px; +`; + +const bookmarkList = () => ( + + Bookmarks + + + { + bookmarkData.groups.map((group) => ( + + {group.name} + { + group.items.map((link) => ( + {link.name} + )) + } + + )) + } + + + +); + +export default bookmarkList; \ No newline at end of file diff --git a/src/components/data/apps.json b/src/components/data/apps.json new file mode 100644 index 0000000..495f0e4 --- /dev/null +++ b/src/components/data/apps.json @@ -0,0 +1,58 @@ +{ + "apps": [ + { + "name": "PiHole", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "vpn_lock" + }, + { + "name": "Plex", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "tv" + }, + { + "name": "NextCloud", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "filter_drama" + }, + { + "name": "Ghost", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "rss_feed" + }, + { + "name": "Minecraft", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "games" + }, + { + "name": "pfSense", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "security" + }, + { + "name": "ESXi", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "dns" + }, + { + "name": "Tautulli", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "bar_chart" + }, + { + "name": "Grafana", + "displayURL": "example.com", + "URL": "https://example.com", + "icon": "show_chart" + } + ] +} \ No newline at end of file diff --git a/src/components/data/bookmarks.json b/src/components/data/bookmarks.json new file mode 100644 index 0000000..b916898 --- /dev/null +++ b/src/components/data/bookmarks.json @@ -0,0 +1,140 @@ +{ + "groups": [ + { + "name": "Communicate", + "items": [ + { + "name": "Discord", + "url": "https://example.com" + }, + { + "name": "Gmail", + "url": "https://example.com" + }, + { + "name": "Slack", + "url": "https://example.com" + } + ] + }, + { + "name": "Cloud", + "items": [ + { + "name": "Box", + "url": "https://example.com" + }, + { + "name": "Dropbox", + "url": "https://example.com" + }, + { + "name": "Drive", + "url": "https://example.com" + } + ] + }, + { + "name": "Design", + "items": [ + { + "name": "Awwwards", + "url": "https://example.com" + }, + { + "name": "Dribbble", + "url": "https://example.com" + }, + { + "name": "Muz.li", + "url": "https://example.com" + } + ] + }, + { + "name": "Dev", + "items": [ + { + "name": "Codepen", + "url": "https://example.com" + }, + { + "name": "Devdocs", + "url": "https://example.com" + }, + { + "name": "Devhints", + "url": "https://example.com" + } + ] + }, + { + "name": "Lifestyle", + "items": [ + { + "name": "Design Milk", + "url": "https://example.com" + }, + { + "name": "Dwell", + "url": "https://example.com" + }, + { + "name": "Freshome", + "url": "https://example.com" + } + ] + }, + { + "name": "Media", + "items": [ + { + "name": "Spotify", + "url": "https://example.com" + }, + { + "name": "Trakt", + "url": "https://example.com" + }, + { + "name": "YouTube", + "url": "https://example.com" + } + ] + }, + { + "name": "Reading", + "items": [ + { + "name": "Instapaper", + "url": "https://example.com" + }, + { + "name": "Medium", + "url": "https://example.com" + }, + { + "name": "Reddit", + "url": "https://example.com" + } + ] + }, + { + "name": "Tech", + "items": [ + { + "name": "TheNextWeb", + "url": "https://example.com" + }, + { + "name": "The Verge", + "url": "https://example.com" + }, + { + "name": "MIT Technology Review", + "url": "https://example.com" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/components/data/search.json b/src/components/data/search.json new file mode 100644 index 0000000..243b18e --- /dev/null +++ b/src/components/data/search.json @@ -0,0 +1,64 @@ +{ + "providers":[ + { + "name":"Allmusic", + "url":"https://www.allmusic.com/search/all/", + "prefix":"/a" + }, + { + "name":"Discogs", + "url":"https://www.discogs.com/search/?q=", + "prefix":"/di" + }, + { + "name":"Duck Duck Go", + "url":"https://duckduckgo.com/?q=", + "prefix":"/d" + }, + { + "name":"iMDB", + "url":"https://www.imdb.com/find?q=", + "prefix":"/i" + }, + { + "name":"TheMovieDB", + "url":"https://www.themoviedb.org/search?query=", + "prefix":"/m" + }, + { + "name":"Reddit", + "url":"https://www.reddit.com/search?q=", + "prefix":"/r" + }, + { + "name":"Qwant", + "url":"https://www.qwant.com/?q=", + "prefix":"/q" + }, + { + "name":"Soundcloud", + "url":"https://soundcloud.com/search?q=", + "prefix":"/so" + }, + { + "name":"Spotify", + "url":"https://open.spotify.com/search/results/", + "prefix":"/s" + }, + { + "name":"TheTVDB", + "url":"https://www.thetvdb.com/search?q=", + "prefix":"/tv" + }, + { + "name":"Trakt", + "url":"https://trakt.tv/search?query=", + "prefix":"/t" + }, + { + "name": "YouTube", + "url": "https://youtube.com/results?search_query=", + "prefix":"/yt" + } + ] + } \ No newline at end of file diff --git a/src/components/data/themes.json b/src/components/data/themes.json new file mode 100644 index 0000000..c6462a5 --- /dev/null +++ b/src/components/data/themes.json @@ -0,0 +1,25 @@ +{ + "themes": [ + { + "label": "Classic", + "value": 0, + "mainColor": "#000000", + "accentColor": "#1e272e", + "backgroundColor": "#ffffff" + }, + { + "label": "Dark", + "value": 1, + "mainColor": "#ffffff", + "accentColor": "#999999", + "backgroundColor": "#000000" + }, + { + "label": "Raw", + "value": 2, + "mainColor": "", + "accentColor": "", + "backgroundColor": "#ffffff" + } + ] +} \ No newline at end of file diff --git a/src/components/greeter.js b/src/components/greeter.js new file mode 100644 index 0000000..054dd41 --- /dev/null +++ b/src/components/greeter.js @@ -0,0 +1,73 @@ +import React from 'react'; +import styled from 'styled-components'; + +import themeData from './data/themes.json' +const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0]; + +const GreeterContainer = styled.div` + padding: 2rem 0 2rem 0; +`; + +const GreetText = styled.h1` + font-family: Roboto, sans-serif; + font-weight: 900; + font-size: 45px; + margin: 0.5rem 0 0.5rem 0; + color: ${selectedTheme.mainColor}; +`; + +const DateText = styled.h3` + font-family: Roboto, sans-serif; + font-weight: 400; + font-size: 15px; + text-transform: uppercase; + margin: 0; + color: ${selectedTheme.accentColor}; +`; + +const getGreeting = () => { + // Maybe add some expandability for different greetings? + return "Hello World!" +} + +const getExtension = (day) => { + let extension = "" + + if ((day > 4 && day <= 20) || (day > 20 && day % 10 >= 4)) { + extension = "th" + } else if (day % 10 === 1) { + extension = "st" + } else if (day % 10 === 2) { + extension = "nd" + } else if (day % 10 === 3) { + extension = "rd" + } + + return extension +} + +const getDateString = () => { + let currentDate = new Date(); + + const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; + + const weekDayNames = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + + return weekDayNames[currentDate.getUTCDay()] + ", " + monthNames[currentDate.getUTCMonth()] + " " + currentDate.getDate() + getExtension(currentDate.getDate()) + " " + currentDate.getFullYear(); +} + +const greeter = () => { + + let date = getDateString(); + let greeting = getGreeting(); + + return ( + + { date } + { greeting } + + ); +} + + +export default greeter; \ No newline at end of file diff --git a/src/components/searchBar.js b/src/components/searchBar.js new file mode 100644 index 0000000..e2558d8 --- /dev/null +++ b/src/components/searchBar.js @@ -0,0 +1,69 @@ +import React, {useState} from 'react'; +import styled from 'styled-components'; + +import searchData from './data/search.json'; + +import themeData from './data/themes.json'; +const selectedTheme = localStorage.getItem("theme") ? JSON.parse(localStorage.getItem("theme")) : themeData.themes[0]; + +const SearchInput = styled.input` + width: 100%; + font-size: 16px; + border: none; + border-bottom: 1px solid ${selectedTheme.accentColor}; + background: none; + border-radius: 0; + color: ${selectedTheme.mainColor}; +`; + +const handleQueryWithProvider = (query) => { + + let queryArray = query.split(" "); + + let prefix = queryArray[0]; + + queryArray.shift(); + + let searchQuery = queryArray.join(" "); + + var foundProvider = false; + searchData.providers.forEach((provider) => { + if (provider.prefix === prefix) { + foundProvider = true; + window.location = provider.url + searchQuery + } + }) + + if (!foundProvider) { + window.location = "https://google.com/search?q=" + query; + } +} + +const SearchBar = () => { + + let [input, setInput] = useState(); + + const handleSearchQuery = (e) => { + + var query = input; + + console.log(query) + + if (query.split(" ")[0].includes("/")) { + handleQueryWithProvider(query) + } else { + window.location = "https://google.com/search?q=" + query; + } + + e.preventDefault(); + } + + return ( +
handleSearchQuery(e)}> + setInput(e.target.value)}> +