Skip to content

Commit

Permalink
new widdgets | removed concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaneeyo committed Oct 23, 2023
1 parent 7607254 commit be04054
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 205 deletions.
24 changes: 9 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@ if (fs.existsSync(backgroundServicePath)) {
}

// declares the variables so the app doesnt outputs many error
let settingsWindow = null;
let musicWidget = null;
let batteryWidget = null;
let deviceCareWidget = null;
let weatherWidget = null;
let topStoriesWidget = null;
let flightWidget = null;
let smartThingsWidget = null;
let calendarWidget = null;
let countdownWidget = null;
let quickNotesWidget = null;
let untisWidget = null;
let digitalClockWidget = null;
let forecastWidget = null;
let upcomingMovies = null;
let upcomingMoviesWidget = null;

const folderPath = path.join(os.homedir(), 'AppData', 'Local', 'Samsung-Widgets');

Expand All @@ -59,15 +56,13 @@ const positionData = {
deviceCareWidget: { y: "400", x: "75" },
weatherWidget: { y: "550", x: "75" },
flightWidget: { y: "700", x: "75" },
smartThingsWidget: { y: "300", x: "475" },
topStoriesWidget: { y: "75", x: "475" },
calendarWidget: { y: "300", x: "475" },
countdownWidget: { y: "550", x: "475" },
quickNotesWidget: { y: "750", x: "475" },
quickNotesWidget: { y: "550", x: "475" },
untisWidget: { y: "900", x: "75" },
digitalClockWidget: { y: "75", x: "875" },
forecastWidget: { y: "200", x: "875" },
forecastWidget: { y: "375", x: "875" },
forecastWidget: { y: "750", x: "475" },
upcomingMoviesWidget: { y: "200", x: "875" },
};

const stateData = {
Expand All @@ -77,14 +72,12 @@ const stateData = {
weatherWidget: { show: "true" },
topStoriesWidget: { show: "false" },
flightWidget: { show: "false" },
smartThingsWidget: { show: "false" },
calendarWidget: { show: "true" },
countdownWidget: { show: "false" },
quickNotesWidget: { show: "true" },
untisWidget: { show: "false" },
digitalClockWidget: { show: "true" },
forecastWidget: { show: "false" },
upcomingMovies: { show: "false" },
upcomingMoviesWidget: { show: "false" },
};

const weatherData = {
Expand Down Expand Up @@ -137,13 +130,12 @@ const widgetsData = {
{ name: "weatherWidget", width: 390, height: 125, html: "./src/widgets/weather/weather.html", "clickthrough": true },
{ name: "topStoriesWidget", width: 390, height: 200, html: "./src/widgets/news/topStories.html", "clickthrough": true },
{ name: "flightWidget", width: 390, height: 175, html: "./src/widgets/wallet/flight.html", "clickthrough": true },
{ name: "smartThingsWidget", width: 390, height: 125, html: "./src/widgets/smartThings/smartThings.html", "clickthrough": true },
{ name: "calendarWidget", width: 390, height: 225, html: "./src/widgets/calendar/calendar.html", "clickthrough": true },
{ name: "countdownWidget", width: 390, height: 175, html: "./src/widgets/calendar/countdown.html", "clickthrough": true },
{ name: "quickNotesWidget", width: 390, height: 175, html: "./src/widgets/notes/quickNotes.html", "clickthrough": false },
{ name: "untisWidget", width: 390, height: 125, html: "./src/widgets/untis.html", "clickthrough": true },
{ name: "digitalClockWidget", width: 390, height: 100, html: "./src/widgets/clock/digitalClock.html", "clickthrough": true },
{ name: "forecastWidget", width: 390, height: 175, html: "./src/widgets/videoPlayer/upcomingMovies.html", "clickthrough": true },
{ name: "forecastWidget", width: 390, height: 175, html: "./src/widgets/weather/forecast.html", "clickthrough": true },
{ name: "upcomingMoviesWidget", width: 390, height: 200, html: "./src/widgets/videoPlayer/upcomingMovies.html", "clickthrough": true },
],
};

Expand Down Expand Up @@ -196,6 +188,8 @@ app.on('ready', () => {

widgetWindow.loadFile(path.join(__dirname, widget.html));

widgetWindow.webContents.openDevTools()

// sets the variable again to null when its closed
widgetWindow.on('closed', () => {
eval(`${widget.name} = null`);
Expand Down
74 changes: 0 additions & 74 deletions src/css/widgets/calendar/countdown.css

This file was deleted.

17 changes: 0 additions & 17 deletions src/css/widgets/smartThings/smartThings.css

This file was deleted.

27 changes: 25 additions & 2 deletions src/css/widgets/videoPlayer/upcomingMovies.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body {
padding: 5px 15px 5px 15px;
box-sizing: border-box;
align-items: center;
justify-content: center;
justify-content: space-evenly;
flex-direction: column;
}

Expand All @@ -28,6 +28,29 @@ header {

#container-movies {
display: flex;
justify-content: center;
justify-content: space-between;
align-items: center;
width: 100%;
}

.movie-container {
flex-direction: column;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}

.poster {
height: 120px;
border-radius: 12px;
}

.name {
font-size: 12px;
width: 66px;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Empty file removed src/js/calendar/countdown.js
Empty file.
17 changes: 0 additions & 17 deletions src/js/smartThings/smartThings.js

This file was deleted.

21 changes: 21 additions & 0 deletions src/js/videoPlayer/upcomingMovies.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,25 @@ window.addEventListener("DOMContentLoaded", () => {
containerMain.style.color = textColor;

containerMain.style.background = `linear-gradient(135deg, rgb(${colorData.red}, ${colorData.green}, ${colorData.blue}) 0%, rgb(${colorData.red - 35}, ${colorData.green - 35}, ${colorData.blue - 35}) 100%)`;

async function setMovies() {
const posters = document.getElementsByClassName('poster')
const names = document.getElementsByClassName('name')

const movieResponse = await fetch('https://api.themoviedb.org/3/movie/upcoming?language=en-US&page=1', {
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJmYTJlZTcyZjhkYjRhMWQyMTgwY2Q1YzUzM2E0ODlhMCIsInN1YiI6IjY1MjZhMzJmZmQ2MzAwNWQ3OGQ3ODY2ZCIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.TyvVBN5Lw6lp84n-hoTrhLBQMsad92mmuBZ7RU4Ir7A"
}
})

const movieData = await movieResponse.json()

for (i = 0; i < 4; i++) {
names[i].innerHTML = movieData.results[i].title
posters[i].src = `https://image.tmdb.org/t/p/original${movieData.results[i].poster_path}`
console.log(`https://image.tmdb.org/t/p/original${movieData.results[i].poster_path}`)
}
}
setMovies()
})
51 changes: 0 additions & 51 deletions src/widgets/calendar/countdown.html

This file was deleted.

18 changes: 0 additions & 18 deletions src/widgets/smartThings/smartThings.html

This file was deleted.

23 changes: 12 additions & 11 deletions src/widgets/videoPlayer/upcomingMovies.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
</header>

<container id="container-movies">
<container id="movie-container">
<span>Avengers: Endgame</span>
<container class="movie-container">
<img class="poster">
<span class="name">Avengers: Endgame</span>
</container>

<container id="movie-container">
<span>Avengers: Endgame</span>

<container class="movie-container">
<img class="poster">
<span class="name">Avengers: Endgame</span>
</container>

<container id="movie-container">
<span>Avengers: Endgame</span>

<container class="movie-container">
<img class="poster">
<span class="name">Avengers: Endgame</span>
</container>

<container id="movie-container">
<span>Avengers: Endgame</span>

<container class="movie-container">
<img class="poster">
<span class="name">Avengers: Endgame</span>
</container>
</container>
</container>
Expand Down

0 comments on commit be04054

Please sign in to comment.