From 6bb5f8a1a6063f2ff0cf492760789a9d3b339424 Mon Sep 17 00:00:00 2001 From: kaitlynkittyy Date: Thu, 11 Apr 2024 13:25:55 -0400 Subject: [PATCH] major changes to the UI/UX of the screenshare modal --- src/renderer/components/ScreenSharePicker.tsx | 190 ++++++++++-------- src/renderer/components/screenSharePicker.css | 62 +++--- 2 files changed, 134 insertions(+), 118 deletions(-) diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index c6aa2e7..e83a324 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -16,6 +16,7 @@ import { Select, Switch, Text, + Tooltip, UserStore, useState } from "@vencord/types/webpack/common"; @@ -187,26 +188,31 @@ function StreamSettings({ deps: [source.id] } ); - const [visible, setVisible] = useState(false); + const preview = ( +
+ stream preview; +
+ ); // the source's name is not properly being displayed return (
What you're streaming
- - - - - - stream preview - +
+ + + {({ onMouseEnter, onMouseLeave }) => ( +
+ Show Preview +
+ )} +
+
+
Stream Settings @@ -409,58 +415,34 @@ function ModalComponent({ - + + // reapply contraints after some time to let discord resubmit stream + // i believe there MUST be way to do it cleaner.. + if (conn) { + setTimeout(() => { + console.log(conn); + const track = conn.input.stream.getVideoTracks()[0]; + console.log(track); + const frameRate = Number(settings.fps); + const height = Number(settings.resolution); + const width = Math.round(height * (16 / 9)); + var constraints = track.getConstraints(); + const newConstraints = { + ...constraints, + frameRate, + advanced: [{ width: width, height: height }], + resizeMode: "none" + }; + track.applyConstraints(newConstraints).then(() => { + console.log("Applied constraints from ScreenSharePicker successfully."); + console.log("New constraints:", track.getConstraints()); + }); - {selected && !skipPicker ? ( - - ) : ( - - )} +
+
+ {selected && !skipPicker ? ( + + ) : ( + + )} +
); diff --git a/src/renderer/components/screenSharePicker.css b/src/renderer/components/screenSharePicker.css index d1215c2..87db0e3 100644 --- a/src/renderer/components/screenSharePicker.css +++ b/src/renderer/components/screenSharePicker.css @@ -8,6 +8,7 @@ .vcd-screen-picker-footer { display: flex; + justify-content: space-between; gap: 1em; } @@ -52,17 +53,16 @@ box-sizing: border-box; } -.vcd-screen-picker-preview img { - width: 100%; - margin-bottom: 0.5em; -} - .vcd-screen-picker-preview { display: flex; - flex-direction: column; justify-content: center; align-items: center; margin-bottom: 1em; + top: 105%; +} + +.vcd-screen-picker-preview img { + width: 50%; } .vcd-screen-picker-radio input { @@ -130,29 +130,17 @@ font-weight: 400; } -.vcd-screen-picker-preview-switch { - margin-top: 1em; -} - .not-visible { display: none; } -.vcd-screen-picker-preview-buttons { - display: flex; - flex-direction: row; - justify-content: space-between; - background-color: var(--background-secondary); - margin-bottom: 1em; -} - -.vcd-screen-picker-subtle-button { +.vcd-screen-picker-tooltip { background-color: transparent; - color: var(--primary-500); + color: var(--text-normal); font-weight: 500; font-size: 14px; - font-style: bold; - text-transform: uppercase; + display: flex; + justify-content: center; } .vcd-screen-picker-button{ @@ -163,19 +151,23 @@ border-radius: 3px; } -.fade-in { - animation-name: fade-in; - animation-duration: .25s; - animation-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1); +.vcd-screen-picker-cancel { + display: flex; + flex-wrap: nowrap; + flex-direction: row; + justify-content: space-around; } - - @keyframes fade-in { - 0% { - opacity: 0; - transform: scale(0, 0); + +.vcd-screen-picker-startbuttons { + margin-left: 0.5em; + margin-right: 0.5em; } -100% { - opacity: 1; - transform: scale(1, 1); - } + +.vcd-screen-picker-footerbuttons { + box-sizing: border-box; + margin-left: none; + justify-content: space-between; + display: flex; + flex-wrap: nowrap; + flex-direction: row; } \ No newline at end of file