Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marketplace</title>
</head>
<body>
<h1>Marketplace</h1>
<input type="text" id="language" placeholder="Filter by language" />
<input type="number" id="stars" placeholder="Minimum stars" />
<button onclick="applyFilters()">Apply Filters</button>
<ul id="repoList"></ul>

<script>
let repos = [];

const fetchRepos = async () => {
try {
const response = await fetch('https://api.github.com/repositories');
repos = await response.json();
displayRepos();
} catch (error) {
console.error('Error fetching repositories:', error);
}
};

const displayRepos = () => {
const repoList = document.getElementById('repoList');
repoList.innerHTML = '';
repos.forEach(repo => {
const listItem = document.createElement('li');
listItem.textContent = repo.name;
repoList.appendChild(listItem);
});
};

const applyFilters = () => {
const language = document.getElementById('language').value;
const stars = Number(document.getElementById('stars').value);
console.log('Filtering by:', { language, stars });
// Basic filtering logic can be implemented here
};

fetchRepos();
</script>
</body>
</html>
53 changes: 53 additions & 0 deletions frontend/src/components/Marketplace.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { useState, useEffect } from 'react';
import axios from 'axios';

const Marketplace = () => {
const [repos, setRepos] = useState([]);
const [language, setLanguage] = useState('');
const [stars, setStars] = useState(0);

const fetchRepos = async () => {
try {
const result = await axios.get('https://api.github.com/repositories');
setRepos(result.data);
} catch (error) {
console.error('Error fetching repositories: ', error);
}
};

const handleFilter = () => {
// Basic filtering logic can be placed here.
console.log('Filtering by:', { language, stars });
};

useEffect(() => {
fetchRepos();
}, []);

return (
<div>
<h1>Marketplace</h1>
<input
type="text"
placeholder="Filter by language"
value={language}
onChange={(e) => setLanguage(e.target.value)}
/>
<input
type="number"
placeholder="Minimum stars"
value={stars}
onChange={(e) => setStars(Number(e.target.value))}
/>
<button onClick={handleFilter}>Apply Filters</button>
<ul>
{repos.map((repo) => (
<li key={repo.id}>{repo.name}</li>
))}
</ul>
</div>
);
};

export default Marketplace;
Binary file added tests/__pycache__/test_bounties.cpython-312.pyc
Binary file not shown.
Binary file added tests/__pycache__/test_marketplace.cpython-312.pyc
Binary file not shown.
13 changes: 13 additions & 0 deletions tests/test_bounties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import unittest

class TestBountyPosting(unittest.TestCase):
def test_post_bounty(self):
# Placeholder for testing bounty posting
pass

def test_retrieve_bounty(self):
# Placeholder for testing bounty retrieval
pass

if __name__ == '__main__':
unittest.main()
15 changes: 15 additions & 0 deletions tests/test_marketplace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This Python script performs a unit test for the Marketplace component

import unittest

class TestMarketplace(unittest.TestCase):
def test_fetch_repos(self):
# Test the fetch_repos function here
pass

def test_handle_filter(self):
# Test the handle_filter function here
pass

if __name__ == '__main__':
unittest.main()
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"jsx": "react",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
2 changes: 2 additions & 0 deletions typedefs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module 'react';
declare module 'axios';