-
Notifications
You must be signed in to change notification settings - Fork 41
basic tailwind UI #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic tailwind UI #101
Conversation
koray-eren
commented
Apr 14, 2022
- room directory UI
- message UI formatting (excl. timestamps + link previews)
- light mode/dark mode switch
- pop up QR code/link modal
@@ -0,0 +1,33 @@ | |||
# uwsgi configuration for listening directly on port 80; this is the simplest setup, but is less |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray config file checked in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean that this file shouldn't be commited right?
sogs/templates/base.html
Outdated
<div class="flex space-x-4 "> | ||
{% block invite %} | ||
{% endblock %} | ||
<button id="moonIcon" class='px-1 rounded' onclick="toggleDarkMode()"><img src="{{ url_for('static', filename='moon-d-50-min.png') }}" alt="moon"></button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use svg instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no SVGs please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not?
Is still related to security risks that svgs can run JS code? If yes, better not use JS at all, right? If a user can change the svg file to include malicious JS code, surely he can change the JS code itself to make it malicious, right?
sogs/static/output.css
Outdated
/* | ||
! tailwindcss v3.0.23 | MIT License | https://tailwindcss.com | ||
*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}html{font-family:Roboto,system-ui,sans-serif}*,:after,:before{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.static{position:static}.absolute{position:absolute}.relative{position:relative}.left-1\/2{left:50%}.top-1\/2{top:50%}.m-5{margin:1.25rem}.m-2{margin:.5rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.block{display:block}.flex{display:flex}.grid{display:grid}.aspect-square{aspect-ratio:1/1}.h-full{height:100%}.h-32{height:8rem}.h-24{height:6rem}.h-screen{height:100vh}.h-28{height:7rem}.h-16{height:4rem}.max-h-32{max-height:8rem}.w-fit{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.w-5\/6{width:83.333333%}.w-\[93vw\]{width:93vw}.max-w-2xl{max-width:42rem}.flex-none{flex:none}.shrink{flex-shrink:1}.translate-x-\[-50\%\]{--tw-translate-x:-50%}.translate-x-\[-50\%\],.translate-y-\[-50\%\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.justify-items-center{justify-items:center}.gap-y-2{row-gap:.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-normal{white-space:normal}.break-all{word-break:break-all}.rounded-lg{border-radius:.5rem}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.border-2{border-width:2px}.border-l-2{border-left-width:2px}.border-b-2{border-bottom-width:2px}.border-sessionGreen{--tw-border-opacity:1;border-color:rgb(0 233 123/var(--tw-border-opacity))}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-sessionGreen{--tw-bg-opacity:1;background-color:rgb(0 233 123/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-lightGray{--tw-bg-opacity:1;background-color:rgb(88 88 88/var(--tw-bg-opacity))}.bg-opacity-80{--tw-bg-opacity:0.8}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-sm{font-size:.875rem;line-height:1.25rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.italic{font-style:italic}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-sessionGreen{--tw-text-opacity:1;color:rgb(0 233 123/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.decoration-black{-webkit-text-decoration-color:#000;text-decoration-color:#000}.decoration-2{text-decoration-thickness:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-500{transition-duration:.5s}.hover\:bg-black:hover{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark .dark\:border-lightGray{--tw-border-opacity:1;border-color:rgb(88 88 88/var(--tw-border-opacity))}.dark .dark\:border-sessionGreen{--tw-border-opacity:1;border-color:rgb(0 233 123/var(--tw-border-opacity))}.dark .dark\:bg-lightGray{--tw-bg-opacity:1;background-color:rgb(88 88 88/var(--tw-bg-opacity))}.dark .dark\:bg-otherGray{--tw-bg-opacity:1;background-color:rgb(39 39 38/var(--tw-bg-opacity))}.dark .dark\:bg-sessionGreen{--tw-bg-opacity:1;background-color:rgb(0 233 123/var(--tw-bg-opacity))}.dark .dark\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark .dark\:text-sessionGreen{--tw-text-opacity:1;color:rgb(0 233 123/var(--tw-text-opacity))}.dark .dark\:text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.dark .dark\:decoration-white{-webkit-text-decoration-color:#fff;text-decoration-color:#fff}.dark .dark\:hover\:bg-sessionGreen:hover{--tw-bg-opacity:1;background-color:rgb(0 233 123/var(--tw-bg-opacity))}.dark .dark\:hover\:text-black:hover{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}@media (min-width:365px){.xs\:text-4xl{font-size:2.25rem;line-height:2.5rem}.xs\:text-xl{font-size:1.25rem;line-height:1.75rem}.xs\:text-3xl{font-size:1.875rem;line-height:2.25rem}.xs\:text-lg{font-size:1.125rem;line-height:1.75rem}}@media (min-width:640px){.sm\:h-20{height:5rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-between{justify-content:space-between}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:pl-0{padding-left:0}.sm\:pt-2{padding-top:.5rem}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width:768px){.md\:h-28{height:7rem}}@media (min-width:1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file is generated right?
If yes, it should be removed from the git and added to .gitignore. It's not supposed to be there if it's generated
throw Error(err); | ||
} | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to setup prettier to avoid those changesw
@@ -0,0 +1,33 @@ | |||
# uwsgi configuration for listening directly on port 80; this is the simplest setup, but is less |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean that this file shouldn't be commited right?
sogs/templates/base.html
Outdated
<p class=" font-bold text-sessionGreen dark:text-sessionGreen text-lg xs:text-xl sm:text-2xl">Session Open </p> | ||
<p class=" font-bold text-sessionGreen dark:text-sessionGreen text-lg xs:text-xl sm:text-2xl">Group Server</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe don't name this sessionGreen
as we want to not stay to close to Session
maybe just accent
?
sogs/templates/base.html
Outdated
function setPageTheme(){ | ||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | ||
htmlElement.classList.add('dark') | ||
sunIcon.style.display = 'block' | ||
moonIcon.style.display = 'none' | ||
} else { | ||
htmlElement.classList.remove('dark') | ||
sunIcon.style.display = 'none' | ||
moonIcon.style.display = 'block' | ||
} | ||
} | ||
|
||
function toggleDarkMode(){ | ||
if ('theme' in localStorage && localStorage.theme === 'light') { | ||
localStorage.theme = 'dark' | ||
setPageTheme(); | ||
} else { | ||
localStorage.theme = 'light' | ||
setPageTheme(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default theme is light
first click switch to light again
second click switch to dark
you can test this in an incognito window
easy fix would be I think
if (!localStorage.theme || localStorage.theme === 'light') {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i was unsure on this - did it this way as a quick fix to avoid flash of light mode when set to dark theme - i thought its better to default to dark than to have light mode flash every time for a dark mode user - ill look into it some more and change
sogs/routes/views.py
Outdated
from ..utils import message_body, decode_base64, message_contents | ||
from .. import config, crypto, http | ||
from ..model.room import get_accessible_rooms | ||
from ..model.user import User | ||
from .messages import message_single, messages_recent | ||
from . import auth, converters # noqa: F401 | ||
from .. import session_pb2 as protobuf | ||
import time | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all of those changes needed?
tailwind.config.js
Outdated
colors: { | ||
sessionGreen: '#00e97b', | ||
lightGray: '#585858', | ||
otherGray: '#272726' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
darkGray?
i rebased this ontop of dev and ran the linter in #102 |