Dark mode, UI redesign beta and some test changes

This commit is contained in:
RedoX 2021-06-21 12:05:07 +00:00
parent d35646b5b1
commit a10a1c7c80
7 changed files with 98 additions and 31 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ app.json
Procfile
.vscode/
.gitignore
poetry.lock
pyproject.toml

2
.replit Normal file
View File

@ -0,0 +1,2 @@
language = "python3"
run = "python run-repl.py"

View File

@ -4,7 +4,33 @@
<a href="https://github.com/odysseusmax/tg-index" target="_blank"> @odysseusmax </a>
</div>
</footer>
<script>
function toggleColorMode() {
element = document.documentElement;
if (element.className == "light") {
element.className = "dark";
localStorage.theme = 'dark';
} else {
element.className = "light";
localStorage.theme = 'light';
}
}
function chatImgAlt() {
document.getElementById('chatimg').src = 'https://s3.imgcdn.dev/nWNtu.jpg'
}
</script>
<!--
<script>
function toggleColorMode() {
if (localStorage.theme = 'light') {
localStorage.theme = 'dark';
} else {
localStorage.theme = 'dark';
}
}
</script>
-->
</body>
</html>

View File

@ -1,44 +1,48 @@
<!doctype html>
<html lang="en">
<html class="light" lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.fluidplayer.com/v3/current/fluidplayer.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.1.4/dist/tailwind-dark.min.css" rel="stylesheet">
<script src="https://cdn.fluidplayer.com/v3/current/fluidplayer.min.js">
<style>
@import url('https://fonts.googleapis.com/css?family=PT+Sans&display=swap');
* {
font-family: 'PT Sans';
}
</style>
</script>
<script>
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.className = 'dark';
} else {
document.documentElement.className = 'light';
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
* {
font-family: 'Roboto', sans-serif;
}
</style>
<script>
window.onload = () => {
<script>
window.onload = () => {
// set title as host url
const titleA = document.getElementById("title-a")
titleA.innerHTML = document.location.host
}
</script>
</script>
<title>
{% if title %} {{title}} {% else %} Telegram Index {% endif %}
</title>
<title>
{% if title %} {{title}} {% else %} Telegram Index {% endif %}
</title>
</head>
<body>
<body class="dark:bg-black dark:text-white">
<header class="bg-blue-300 text-white mb-2 p-4 w-full shadow">
<div class="mx-auto flex justify-between content-center max-w-screen-xl">
<a href="/" id="title-a" class="text-left text-xl lg:text-2xl xl:text-3xl"> Telegram index </a>
{% if authenticated %} <a href="/logout" class="text-right"> Logout </a> {% else %} {%
endif %}
</div>
<header class="bg-blue-300 dark:bg-red-700 text-white mb-2 p-4 w-full shadow">
<div class="mx-auto flex justify-between content-center max-w-screen-xl">
<a href="/" id="title-a" class="text-left text-xl lg:text-2xl xl:text-3xl"> Telegram index </a>
{% if authenticated %} <a href="/logout" class="text-right"> Logout </a> {% else %} {% endif %}
</div>
</header>
<div class="m-auto w-full min-h-screen max-w-screen-xl">
</header>
<div class="m-auto w-full min-h-screen max-w-screen-xl">

View File

@ -10,7 +10,7 @@
<a title="{{chat.name}}" href="/{{chat.page_id}}"
class="mx-auto flex flex-col justify-items-center w-2/3 min-h-full md:w-2/5 lg:w-1/6 rounded my-2 p-2 shadow hover:shadow-md hover:border hover:border-blue-300 hover:bg-blue-100">
<img src="/{{chat.page_id}}/logo?big=1" class="w-full rounded-full ">
<img id="chatimg" src="/{{chat.page_id}}/logo?big=1" onerror="chatImgAlt()" class="w-full rounded-full">
<div class="p-4 rounded">{{chat.name}}</div>
</a>

View File

@ -3,7 +3,7 @@
<div class="min-h-full flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-green-500">
Sign in to view the contents
</h2>
</div>

33
run-repl.py Normal file
View File

@ -0,0 +1,33 @@
import os
# from dotenv import load_dotenv
# load_dotenv() # take environment variables from .env.
# Code of your application, which uses environment variables (e.g. from `os.environ` or
# `os.getenv`) as if they came from the actual environment.
os.system("alias python3=python")
def runSetup():
def alert(missing="API_ID , API_HASH"):
print(
f"\nCopy your {missing} and save it into Secrets(Environment variables) Sidebar!\n"
)
api_id = os.getenv("API_ID")
if api_id is None:
alert()
return
session_string = os.getenv("SESSION_STRING")
if session_string is None:
os.system("python app/generate_session_string.py")
alert(missing="SESSION_STRING")
return
os.system("python -m app")
if __name__ == "__main__":
runSetup()