Make a PC builder simulator where user should construct own PC and run it (including…
- User
Make a PC builder simulator where user should construct own PC and run it (including install windows), use HTML + CSS + JS (one file)
- Assistant
Make a PC builder simulator where user should construct own PC and run it (including install windows), use HTML + CSS + JS (one file)
Sure! Below is a simple PC builder simulator implemented in a single HTML file using HTML, CSS, and JavaScript. This simulator allows users to select components, build their PC, and simulate installing Windows.
Note: This is a simplified version for demonstration purposes. In a real-world application, you'd have more components and more complex interactions.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PC Builder Simulator</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
#builder {
width: 600px;
margin: 50px auto;
background: #fff;
padding: 20px;
border-radius: 5px;
}
h1, h2 {
text-align: center;
}
.component {
margin-bottom: 15px;
}
.component label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.component select {
width: 100%;
padding: 8px;
}
#build-btn, #install-btn {
width: 100%;
padding: 10px;
background-color: #28a745;
border: none;
color: #fff;
font-size: 18px;
cursor: pointer;
margin-top: 20px;
border-radius: 5px;
}
#install-btn {
background-color: #007bff;
}
#output {
margin-top: 30px;
padding: 20px;
background: #e9ecef;
border-radius: 5px;
min-height: 50px;
}
</style>
</head>
<body>
<div id="builder">
<h1>PC Builder Simulator</h1>
<div id="components">
<div class="component">
<label for="cpu">CPU</label>
<select id="cpu">
<option value="">Select CPU</option>
<option value="Intel Core i5">Intel Core i5</option>
<option value="Intel Core i7">Intel Core i7</option>
<option value="AMD Ryzen 5">AMD Ryzen 5</option>
<option value="AMD Ryzen 7">AMD Ryzen 7</option>
</select>
</div>
<div class="component">
<label for="gpu">GPU</label>
<select id="gpu">
<option value="">Select GPU</option>
<option value="NVIDIA GTX 1660">NVIDIA GTX 1660</option>
<option value="NVIDIA RTX 3060">NVIDIA RTX 3060</option>
<option value="AMD Radeon RX 5700">AMD Radeon RX 5700</option>
<option value="AMD Radeon RX 6800">AMD Radeon RX 6800</option>
</select>
</div>
<div class="component">
<label for="ram">RAM</label>
<select id="ram">
<option value="">Select RAM</option>
<option value="8GB DDR4">8GB DDR4</option>
<option value="16GB DDR4">16GB DDR4</option>
<option value="32GB DDR4">32GB DDR4</option>
</select>
</div>
<div class="component">
<label for="storage">Storage</label>
<select id="storage">
<option value="">Select Storage</option>
<option value="256GB SSD">256GB SSD</option>
<option value="512GB SSD">512GB SSD</option>
<option value="1TB SSD">1TB SSD</option>
<option value="2TB HDD">2TB HDD</option>
</select>
</div>
</div>
<button id="build-btn">Build PC</button>
<button id="install-btn" style="display:none;">Install Windows</button>
<div id="output"></div>
</div>
<script>
const buildBtn = document.getElementById('build-btn');
const installBtn = document.getElementById('install-btn');
const output = document.getElementById('output');
buildBtn.addEventListener('click', function() {
const cpu = document.getElementById('cpu').value;
const gpu = document.getElementById('gpu').value;
const ram = document.getElementById('ram').value;
const storage = document.getElementById('storage').value;
if (cpu && gpu && ram && storage) {
output.innerHTML = `<h2>PC Built Successfully!</h2>
<p><strong>CPU:</strong> ${cpu}</p>
<p><strong>GPU:</strong> ${gpu}</p>
<p><strong>RAM:</strong> ${ram}</p>
<p><strong>Storage:</strong> ${storage}</p>
<p>Your PC is assembled and ready for the OS installation.</p>`;
installBtn.style.display = 'block';
buildBtn.style.display = 'none';
} else {
output.innerHTML = '<p style="color:red;">Please select all components before building your PC.</p>';
}
});
installBtn.addEventListener('click', function() {
output.innerHTML = '<h2>Installing Windows...</h2><p>Please wait while Windows is being installed.</p>';
installBtn.style.display = 'none';
// Simulate installation time
setTimeout(function() {
output.innerHTML = '<h2>Windows Installed Successfully!</h2><p>Your PC is ready to use.</p>';
}, 3000);
});
</script>
</body>
</html>
How to use the simulator:
Save the above code in a file with an .html extension (e.g., pc_builder_simulator.html).
Open the file in a web browser.
Select one option for each component (CPU, GPU, RAM, Storage).
Click the Build PC button to assemble your PC.
Once the PC is built, click the Install Windows button to simulate installing Windows.
Wait for the simulated installation to complete.
Features:
Component Selection: Users can select from different CPUs, GPUs, RAM, and Storage options.
Build Process: Checks if all components are selected before allowing the build.
Installation Simulation: Simulates Windows installation with a delay to mimic installation time.
User Feedback: Provides messages to guide the user through the building and installation process.
Customization:
You can add more components like Motherboard, Power Supply, Case, etc., by adding more <div class="component"> sections and corresponding <select> elements.
Expand the options within each component to include more hardware choices.
Enhance the installation simulation by adding progress bars or more interactive elements.
Feel free to modify and expand upon this basic simulator to suit your needs!
Not yet included in a published release.