Skip to content

Commit 0176805

Browse files
authored
Merge pull request #4 from Bappy4u/feature/av-2-initialize-vuejs
Feature/av 2 initialize vuejs
2 parents 9147263 + 206a92c commit 0176805

18 files changed

+334
-40
lines changed

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?

README.md

+18-40
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,24 @@
1-
# algorithm-visualizer
2-
### <a href="https://bappy4u.github.io/algorithm-visualizer/">Live Link <img src="https://user-images.githubusercontent.com/26277680/161445394-01bc2179-9fb4-4e57-9cd1-76c47e244ff6.png" data-canonical-src="https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png" width="15" height="auto" /></a>
1+
# algo
32

4-
### Completed Algorithm
5-
* Sorting
6-
* Bubble Sort
7-
* Insertion Sort
8-
* Searching
9-
* Linear Search
10-
* Binary Search
11-
12-
13-
![image](https://user-images.githubusercontent.com/26277680/163478028-586e4e2e-b949-47c6-a6ad-9c418144af6b.png)
14-
![image](https://user-images.githubusercontent.com/26277680/163477034-e55f6751-343f-4e84-bafe-881f03ccd2d7.png)
15-
16-
17-
18-
## Setup
19-
20-
The first thing to do is to clone the repository:
21-
22-
```sh
23-
$ git clone https://github.com/Bappy4u/algorithm-visualizer.git
3+
## Project setup
4+
```
5+
npm install
246
```
25-
Then open `index.html` in the browser. That's it
26-
27-
### What I've used in this project
28-
29-
* JavaScript
30-
* Async & Await function of javaScript
31-
* D3.js for data visualization
32-
* Algorithms
33-
* Html & CSS
34-
35-
36-
### Incomplete feature:
37-
38-
* More Sorting algorithms visualizations
39-
* Linked list visualization
40-
* Tree visualization
41-
* And More...
427

43-
###
8+
### Compiles and hot-reloads for development
9+
```
10+
npm run serve
11+
```
4412

13+
### Compiles and minifies for production
14+
```
15+
npm run build
16+
```
4517

18+
### Lints and fixes files
19+
```
20+
npm run lint
21+
```
4622

23+
### Customize configuration
24+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

jsconfig.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "esnext",
5+
"baseUrl": "./",
6+
"moduleResolution": "node",
7+
"paths": {
8+
"@/*": [
9+
"src/*"
10+
]
11+
},
12+
"lib": [
13+
"esnext",
14+
"dom",
15+
"dom.iterable",
16+
"scripthost"
17+
]
18+
}
19+
}

package.json

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "algo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"description": "* Sorting\r * Bubble Sort\r * Insertion Sort\r * Searching\r * Linear Search\r * Binary Search",
6+
"author": "",
7+
"scripts": {
8+
"serve": "vue-cli-service serve",
9+
"build": "vue-cli-service build",
10+
"lint": "vue-cli-service lint",
11+
"test": "echo \"Error: no test specified\" && exit 1"
12+
},
13+
"main": "index.js",
14+
"dependencies": {
15+
"core-js": "^3.8.3",
16+
"vue": "^3.2.13",
17+
"vue-router": "^4.2.2"
18+
},
19+
"devDependencies": {
20+
"@babel/core": "^7.12.16",
21+
"@babel/eslint-parser": "^7.12.16",
22+
"@vue/cli": "^5.0.8",
23+
"@vue/cli-plugin-babel": "~5.0.0",
24+
"@vue/cli-plugin-eslint": "~5.0.0",
25+
"@vue/cli-service": "~5.0.0",
26+
"eslint": "^7.32.0",
27+
"eslint-plugin-vue": "^8.0.3"
28+
},
29+
"eslintConfig": {
30+
"root": true,
31+
"env": {
32+
"node": true
33+
},
34+
"extends": [
35+
"plugin:vue/vue3-essential",
36+
"eslint:recommended"
37+
],
38+
"parserOptions": {
39+
"parser": "@babel/eslint-parser"
40+
},
41+
"rules": {}
42+
},
43+
"browserslist": [
44+
"> 1%",
45+
"last 2 versions",
46+
"not dead",
47+
"not ie 11"
48+
],
49+
50+
"bugs": {
51+
"url": "https://github.com/Bappy4u/algorithm-visualizer/issues"
52+
},
53+
"homepage": "https://github.com/Bappy4u/algorithm-visualizer#readme",
54+
"keywords": [],
55+
"license": "ISC",
56+
"readme": "ERROR: No README data found!",
57+
"repository": {
58+
"type": "git",
59+
"url": "git+https://github.com/Bappy4u/algorithm-visualizer.git"
60+
}
61+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>Algorithm Visualizer</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<Algorithm-visualizer msg="Welcome to Algorithm Visualizer"/>
3+
</template>
4+
5+
<script>
6+
import AlgorithmVisualizer from './components/AlgorithmVisualizer.vue'
7+
8+
export default {
9+
name: 'App',
10+
components: {
11+
AlgorithmVisualizer
12+
}
13+
}
14+
</script>
15+
16+
<style>
17+
#app {
18+
font-family: Avenir, Helvetica, Arial, sans-serif;
19+
-webkit-font-smoothing: antialiased;
20+
-moz-osx-font-smoothing: grayscale;
21+
text-align: center;
22+
color: #2c3e50;
23+
margin-top: 60px;
24+
}
25+
</style>

src/algorithms/algorithms.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div class="algos">
3+
<h1>Welcome to Algorithm visualizer</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: "home-view"
10+
}
11+
</script>
12+
13+
<style scoped>
14+
15+
</style>

src/algorithms/search/Search.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div>
3+
<h1>Searching Algorithm</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: "SearchView"
10+
}
11+
</script>
12+
13+
<style scoped>
14+
15+
</style>

src/algorithms/sort/Sort.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div>
3+
<h1>Sorting Algorithm</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: "SortView"
10+
}
11+
</script>
12+
13+
<style scoped>
14+
15+
</style>

src/assets/logo.png

6.69 KB
Loading
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<div class="hello">
3+
<MenuView/>
4+
<router-view></router-view>
5+
</div>
6+
</template>
7+
8+
<script>
9+
10+
import MenuView from "./menu";
11+
export default {
12+
name: 'algorithm-visualizer',
13+
components: {MenuView},
14+
props: {
15+
msg: String
16+
}
17+
}
18+
</script>
19+
20+
<!-- Add "scoped" attribute to limit CSS to this component only -->
21+
<style scoped>
22+
h3 {
23+
margin: 40px 0 0;
24+
}
25+
ul {
26+
list-style-type: none;
27+
padding: 0;
28+
}
29+
li {
30+
display: inline-block;
31+
margin: 0 10px;
32+
}
33+
a {
34+
color: #42b983;
35+
}
36+
</style>

src/components/menu.vue

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<template>
2+
<div class="top-menu">
3+
<nav>
4+
<ul>
5+
<li v-for="menuItem in menuItems" :key="menuItem.id" :class="{ active: isActive(menuItem.route) }">
6+
<router-link :to="menuItem.route">{{ menuItem.label }}</router-link>
7+
</li>
8+
</ul>
9+
</nav>
10+
</div>
11+
</template>
12+
13+
<script>
14+
import { useRoute } from 'vue-router';
15+
16+
export default {
17+
name: 'menu-view',
18+
setup() {
19+
const route = useRoute();
20+
21+
const menuItems = [
22+
{ id: 1, label: 'Home', route: '/' },
23+
{ id: 2, label: 'Searching Algorithm', route: '/search' },
24+
{ id: 3, label: 'Sorting Algorithm', route: '/sort' },
25+
// Add more menu items for other algorithms
26+
];
27+
28+
const isActive = (routePath) => {
29+
return route.path === routePath;
30+
};
31+
32+
return {
33+
menuItems,
34+
isActive,
35+
};
36+
},
37+
};
38+
</script>
39+
40+
<style>
41+
.top-menu {
42+
background-color: #f0f0f0;
43+
}
44+
45+
nav ul {
46+
list-style-type: none;
47+
padding: 0;
48+
margin: 0;
49+
}
50+
51+
nav ul li {
52+
display: inline-block;
53+
padding: 10px;
54+
}
55+
56+
nav ul li.active {
57+
background-color: #ccc;
58+
}
59+
</style>

src/core/_helperFunctions.js

Whitespace-only changes.

src/main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
import router from './routes/router';
4+
createApp(App).use(router).mount('#app')

src/routes/router.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { createRouter, createWebHistory } from 'vue-router';
2+
import SearchView from './../algorithms/search/Search.vue';
3+
import homeView from './../algorithms/algorithms.vue';
4+
import SortView from './../algorithms/sort/Sort.vue';
5+
6+
const routes = [
7+
{ path: '/', component: homeView },
8+
{ path: '/search', component: SearchView },
9+
{ path: '/sort', component: SortView },
10+
// Add more routes for other algorithm components
11+
];
12+
13+
const router = createRouter({
14+
history: createWebHistory(),
15+
routes,
16+
});
17+
18+
export default router;

vue.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { defineConfig } = require('@vue/cli-service')
2+
module.exports = defineConfig({
3+
transpileDependencies: true
4+
})

0 commit comments

Comments
 (0)