Skip to content

Commit

Permalink
mogul menu style fixes and prediction toast
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhallock committed Jun 28, 2023
1 parent 94b6b03 commit 71abd20
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default scss`
.c-dialog {
@media (min-width: 768px) {
@media (min-width: 600px) {
width: 540px !important;
height: 100%;
}
Expand All @@ -25,7 +25,7 @@ export default scss`
display: grid;
grid-template-columns: 1fr;
@media (min-width: 768px) {
@media (min-width: 600px) {
grid-template-columns: 1fr 1fr;
}
gap: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default scss`
max-height: 80%;
overflow: hidden;
@media (min-width: 768px) {
@media (min-width: 600px) {
width: unset;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default scss`
overflow: hidden;
width: 90% !important;
@media (min-width: 768px) {
@media (min-width: 600px) {
width: 424px !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default scss`
flex-direction: column;
padding: 24px;
@media (min-width: 768px) {
@media (min-width: 600px) {
padding: 0;
}
}
Expand All @@ -62,7 +62,7 @@ export default scss`
background: var(--mm-color-bg-secondary);
border-radius: 6px;
@media (min-width: 768px) {
@media (min-width: 600px) {
width: 400px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ html, body {
max-width: 200px;
width: 100%;
@media (min-width: 768px) {
@media (min-width: 600px) {
max-width: 232px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default scss`
font-weight: 700;
display: none;
@media (min-width: 768px) {
@media (min-width: 600px) {
display: block;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default scss`
text-align: center;
flex: 1;
@media (min-width: 768px) {
@media (min-width: 600px) {
padding: 32px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default scss`
margin: 16px auto 0 auto;
}
@media (min-width: 768px) {
@media (min-width: 600px) {
padding: 32px 32px 8px 32px;
> .onboard-image {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
OrgUserQuerySignal,
useInterval,
} from "../../shared/mod.ts";
import { getEmbed } from "https://npm.tfl.dev/@trufflehq/sdk@0.3.2"; // TODO: deps file
import { usePageStack } from "../page-stack/mod.ts";
import { useDialog } from "../base/dialog-container/dialog-service.ts";
import DeleteDialog from "../delete-dialog/delete-dialog.tsx";
Expand All @@ -31,6 +32,8 @@ import Time from "../time/time.tsx";
import { getTimeInfo, getWinningInfo } from "../prediction/prediction.tsx";
import styleSheet from "./prediction-tile.scss.js";

const embed = getEmbed();

const PASSIVE_POLL_INTERVAL = 60 * ONE_SECOND_MS;
const RESULTS_TIMOUT = 100 * ONE_SECOND_MS;
// NOTE: we don't currently have a way to clean up onMessage listeners
Expand Down Expand Up @@ -154,12 +157,21 @@ export default function PredictionTile(
);
}

const showPredictionPage = () => {
setIsOpen();
pushPage(<PredictionPage />);
};
// useListenForOpenPrediction(showPredictionPage);

useListenForOpenPrediction(showPredictionPage);
const prediction = prediction$.get();

useEffect(() => {
if (prediction?.id && !hasPredictionEnded) {
embed.showToast({
title: "New prediction!",
body: prediction.question,
onClick: () => {
embed.openWindow();
}
});
}
}, [prediction?.id]);

if (!prediction$.get()) return <></>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default scss`
padding: 0 64px;
@media (min-width: 768px) {
@media (min-width: 600px) {
padding: 0;
}
Expand Down Expand Up @@ -57,7 +57,7 @@ export default scss`
grid-column: span 2;
@media (min-width: 768px) {
@media (min-width: 600px) {
grid-column: span 1;
}
Expand Down Expand Up @@ -224,7 +224,7 @@ export default scss`
box-sizing: border-box;
margin-top: 20px;
@media (min-width: 768px) {
@media (min-width: 600px) {
width: 400px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default scss`
position: relative;
grid-column: span 2;
@media (min-width: 768px) {
@media (min-width: 600px) {
grid-column: span 1;
}
Expand Down

0 comments on commit 71abd20

Please sign in to comment.