Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GEOFARL committed Jun 5, 2023
1 parent de8a20d commit 6f27e55
Show file tree
Hide file tree
Showing 28 changed files with 104 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
dist
release-builds
savedSolutions
release-builds*
savedSolutions
1 change: 0 additions & 1 deletion dist/42e40244edcf332efc9a.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/bundle.a1a836c153ee5bb09b0f.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Domino Game</title><link rel="stylesheet" href="b88d04fba731603756b1.css"/><script src="42e40244edcf332efc9a.js" defer="defer"></script><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"/><script defer="defer" src="bundle.a1a836c153ee5bb09b0f.js"></script><link href="styles.97fd5b21ebb05c3302dc.css" rel="stylesheet"></head><body><div class="overlay hide"></div><div class="modal hide"><div class="modal__content"><header class="modal__header"><h2>Error</h2><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm79 143c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg></header><main class="modal__main"><p class="modal__message">Unable to solve this board positioning!<br/>Try to enter another board</p></main><footer class="modal__footer"></footer></div></div><div class="modal modal__info hide"><div class="modal__content"><header class="modal__header"><h2>Congratulations</h2><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm79 143c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg></header><main class="modal__main"><p class="modal__message">You have successfully solved a board</p></main><footer class="modal__footer"></footer></div></div><div class="content"><h1 class="heading-primary">Domino Game</h1><h3 class="message hide">Solving...</h3><div class="btn-group add-board hide"><button class="btn btn--red" id="add-board">Add new board</button> <button class="btn btn--red btn--red-alternate" id="add-board-exit">Exit</button></div><div class="btn-group add-board solve-board hide"><button class="btn btn--red" id="finish-solving">Finish solving</button> <button class="btn btn--red btn--red-alternate" id="solve-board-exit">Exit</button></div><table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table><section class="menu-section"><div class="btn-group margin-top"><button class="btn" id="generate">Generate</button> <button class="btn btn--alternative" id="solve-ai">Solve AI</button> <button class="btn" id="solve-yourself">Solve Yourself</button></div><div class="board-select"><label for="standard-select">Select which board to solve</label><div class="select"><select id="standard-select"></select> <span class="focus"></span></div></div><div class="btn-group btn-group--wide"><button class="btn btn--alternative" id="enter-new-board">Enter new board</button> <button class="btn" id="remove-current-board">Remove this board</button></div></section><input id="themeSwitcher" class="ThemeToggle" type="checkbox" checked="checked"/> <button class="btn hide" id="clear-board"><p>Clear Board</p><img src="images/delete-icon.svg" alt="clear-btn"/></button></div></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Domino Game</title><link rel="stylesheet" href="b88d04fba731603756b1.css"/><script src="b0bd05e60565fb3c3033.js" defer="defer"></script><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"/><script defer="defer" src="bundle.555a6631e6a44af4a84e.js"></script><link href="styles.97fd5b21ebb05c3302dc.css" rel="stylesheet"></head><body><div class="overlay hide"></div><div class="modal hide"><div class="modal__content"><header class="modal__header"><h2>Error</h2><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm79 143c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg></header><main class="modal__main"><p class="modal__message">Unable to solve this board positioning!<br/>Try to enter another board</p></main><footer class="modal__footer"></footer></div></div><div class="modal modal__info hide"><div class="modal__content"><header class="modal__header"><h2>Congratulations</h2><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm79 143c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg></header><main class="modal__main"><p class="modal__message">You have successfully solved a board</p></main><footer class="modal__footer"></footer></div></div><div class="content"><h1 class="heading-primary">Domino Game</h1><h3 class="message hide">Solving...</h3><div class="btn-group add-board hide"><button class="btn btn--red" id="add-board">Add new board</button> <button class="btn btn--red btn--red-alternate" id="add-board-exit">Exit</button></div><div class="btn-group add-board solve-board hide"><button class="btn btn--red" id="finish-solving">Finish solving</button> <button class="btn btn--red btn--red-alternate" id="solve-board-exit">Exit</button></div><table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table><section class="menu-section"><div class="btn-group margin-top"><button class="btn" id="generate">Generate</button> <button class="btn btn--alternative" id="solve-ai">Solve AI</button> <button class="btn" id="solve-yourself">Solve Yourself</button></div><div class="board-select"><label for="standard-select">Select which board to solve</label><div class="select"><select id="standard-select"></select> <span class="focus"></span></div></div><div class="btn-group btn-group--wide"><button class="btn btn--alternative" id="enter-new-board">Enter new board</button> <button class="btn" id="remove-current-board">Remove this board</button></div></section><input id="themeSwitcher" class="ThemeToggle" type="checkbox" checked="checked"/> <button class="btn hide" id="clear-board"><p>Clear Board</p><img src="images/delete-icon.svg" alt="clear-btn"/></button></div></body></html>
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = {
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
},
testPathIgnorePatterns: ['release-builds/'],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"test": "jest",
"test:watch": "jest --watchAll",
"electron": "npm run build && nodemon --exec electron ./src/electron/main.js",
"package": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=src/assets/domino-svgrepo-com.icns --prune=true --out=release-builds"
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=src/assets/domino-svgrepo-com.icns --prune=true --out=release-builds-mac",
"package-win": "electron-packager . domino_game --overwrite --asar=true --platform=win32 --arch=ia32 --icon=src/assets/domino-icon.ico --prune=true --out=release-builds-win --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Domino Game\""
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Domino/Domino.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Domino from '../../Domino';
import Domino from '../../../src/gameLogic/Domino';

describe('Domino', () => {
test('should have a and b properties', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/DominoGrid/boardPositioning.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DominoGrid from '../../DominoGrid';
import Domino from '../../Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';
import Domino from '../../../src/gameLogic/Domino';

describe('DominoGrid', () => {
describe('isOnBoard', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/DominoGrid/checkValidity.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CellValue from '../../CellValue';
import Domino from '../../Domino';
import DominoGrid from '../../DominoGrid';
import CellValue from '../../../src/gameLogic/CellValue';
import Domino from '../../../src/gameLogic/Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('CellValue', () => {
describe('checkValidity', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/DominoGrid/findAdjSum.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CellValue from '../../CellValue';
import DominoGrid from '../../DominoGrid';
import Domino from '../../Domino';
import CellValue from '../../../src/gameLogic/CellValue';
import DominoGrid from '../../../src/gameLogic/DominoGrid';
import Domino from '../../../src/gameLogic/Domino';

describe('CellValue', () => {
describe('findAdjSum', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/DominoGrid/findAvailablePosition.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DominoGrid from '../../DominoGrid';
import Domino from '../../Domino';
import CellValue from '../../CellValue';
import DominoGrid from '../../../src/gameLogic/DominoGrid';
import Domino from '../../../src/gameLogic/Domino';
import CellValue from '../../../src/gameLogic/CellValue';

describe('DominoGrid', () => {
describe('findAvailablePosition', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/DominoGrid/findDirections.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CellValue from '../../CellValue';
import DominoGrid from '../../DominoGrid';
import CellValue from '../../../src/gameLogic/CellValue';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('DominoGrid', () => {
describe('findDirections', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/DominoGrid/findEmptyCells.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CellValue from '../../CellValue';
import DominoGrid from '../../DominoGrid';
import CellValue from '../../../src/gameLogic/CellValue';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('CellValue', () => {
describe('findEmptyAdjCells', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DominoGrid/generateDominoes.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import DominoGrid from '../../DominoGrid';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('DominoGrid', () => {
describe('generateDominoes', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/DominoGrid/isSolved.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CellValue from '../../CellValue';
import Domino from '../../Domino';
import DominoGrid from '../../DominoGrid';
import CellValue from '../../../src/gameLogic/CellValue';
import Domino from '../../../src/gameLogic/Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('CellValue', () => {
describe('isSolved', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/DominoGrid/placeDomino.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DominoGrid from '../../DominoGrid';
import Domino from '../../Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';
import Domino from '../../../src/gameLogic/Domino';

describe('DominoGrid', () => {
describe('placeDomino', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DominoGrid/shuffleDominoes.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import DominoGrid from '../../DominoGrid';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('DominoGrid', () => {
describe('shuffleDominoes', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/DominoGrid/unPlaceInitialDomino.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DominoGrid from '../../DominoGrid';
import Domino from '../../Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';
import Domino from '../../../src/gameLogic/Domino';

describe('DominoGrid', () => {
describe('unPlaceInitialDomino', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/DominoGrid/validatePos.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CellValue from '../../CellValue';
import Domino from '../../Domino';
import DominoGrid from '../../DominoGrid';
import CellValue from '../../../src/gameLogic/CellValue';
import Domino from '../../../src/gameLogic/Domino';
import DominoGrid from '../../../src/gameLogic/DominoGrid';

describe('DominoGrid', () => {
describe('isSameInRow', () => {
Expand Down
Binary file added src/assets/domino-icon.ico
Binary file not shown.
9 changes: 8 additions & 1 deletion src/data/LocalStorageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export default class LocalStorageManager {
}

existBoards() {
return localStorage.getItem(this.storeKey);
return (
localStorage.getItem(this.storeKey) !== null &&
localStorage.getItem(this.storeKey).length !== 0
);
}

removeBoards() {
localStorage.removeItem(this.storeKey);
}
}
26 changes: 22 additions & 4 deletions src/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const path = require('path');
const fs = require('fs');

const isMac = process.platform === 'darwin';
// const isDev = require('electron-is-dev');
const isDev = true;
const isDev = require('electron-is-dev');
// const isDev = true;

let mainWindow;

Expand All @@ -23,7 +23,6 @@ function createWindow() {
if (isDev) {
mainWindow.webContents.openDevTools();
}

mainWindow.loadFile(path.join(__dirname, '../../dist/index.html'));
}

Expand All @@ -48,7 +47,18 @@ const template = [
// { role: 'fileMenu' }
{
label: 'File',
submenu: [isMac ? { role: 'close' } : { role: 'quit' }],
submenu: [
isMac ? { role: 'close' } : { role: 'quit' },
{
label: 'New Window',
click: createWindow,
accelerator: process.platform === 'darwin' ? 'Cmd+N' : 'Ctrl+N',
},
{
label: 'Reset boards',
click: removeBoards,
},
],
},
// { role: 'viewMenu' },
{
Expand Down Expand Up @@ -92,6 +102,14 @@ function getTime() {
return date.toISOString().split('T').join('_');
}

function removeBoards() {
const window = BrowserWindow.getFocusedWindow();
window.webContents.executeJavaScript(
"localStorage.removeItem('SAVED_BOARDS');"
);
BrowserWindow.getFocusedWindow().reload();
}

async function saveFile(board) {
fs.writeFile(
`/Users/geofarl/Documents/Курсова/domino_game/savedSolutions/${getTime()}.txt`,
Expand Down
Loading

0 comments on commit 6f27e55

Please sign in to comment.