Compare commits

...

2 commits

Author SHA1 Message Date
Imbus
8d23f17f76 Better login modal, post layout fixing 2023-11-13 09:34:32 +01:00
Imbus
e6bf6bc8a6 Version bumps, daisy 4.0 e.t.c. 2023-11-13 09:06:34 +01:00
11 changed files with 429 additions and 247 deletions

View file

@ -8,18 +8,18 @@
"name": "client-solid", "name": "client-solid",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@solidjs/router": "^0.8.3", "@solidjs/router": "^0.9.1",
"solid-js": "^1.7.8" "solid-js": "^1.8.5"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"daisyui": "^3.9.3", "daisyui": "^4.0.1",
"postcss": "^8.4.31", "postcss": "^8.4.31",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.5",
"typescript": "^5.0.2", "typescript": "^5.2.2",
"vite": "^4.4.5", "vite": "^4.5.0",
"vite-plugin-qrcode": "^0.2.2", "vite-plugin-qrcode": "^0.2.2",
"vite-plugin-solid": "^2.7.0" "vite-plugin-solid": "^2.7.2"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -61,30 +61,30 @@
} }
}, },
"node_modules/@babel/compat-data": { "node_modules/@babel/compat-data": {
"version": "7.23.2", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.3.tgz",
"integrity": "sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==", "integrity": "sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/core": { "node_modules/@babel/core": {
"version": "7.23.2", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.2.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.3.tgz",
"integrity": "sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==", "integrity": "sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.2.0", "@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.23.0", "@babel/generator": "^7.23.3",
"@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-compilation-targets": "^7.22.15",
"@babel/helper-module-transforms": "^7.23.0", "@babel/helper-module-transforms": "^7.23.3",
"@babel/helpers": "^7.23.2", "@babel/helpers": "^7.23.2",
"@babel/parser": "^7.23.0", "@babel/parser": "^7.23.3",
"@babel/template": "^7.22.15", "@babel/template": "^7.22.15",
"@babel/traverse": "^7.23.2", "@babel/traverse": "^7.23.3",
"@babel/types": "^7.23.0", "@babel/types": "^7.23.3",
"convert-source-map": "^2.0.0", "convert-source-map": "^2.0.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"gensync": "^1.0.0-beta.2", "gensync": "^1.0.0-beta.2",
@ -100,12 +100,12 @@
} }
}, },
"node_modules/@babel/generator": { "node_modules/@babel/generator": {
"version": "7.23.0", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.3.tgz",
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "integrity": "sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.23.0", "@babel/types": "^7.23.3",
"@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/gen-mapping": "^0.3.2",
"@jridgewell/trace-mapping": "^0.3.17", "@jridgewell/trace-mapping": "^0.3.17",
"jsesc": "^2.5.1" "jsesc": "^2.5.1"
@ -224,9 +224,9 @@
} }
}, },
"node_modules/@babel/helper-module-transforms": { "node_modules/@babel/helper-module-transforms": {
"version": "7.23.0", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz",
"integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-environment-visitor": "^7.22.20",
@ -372,9 +372,9 @@
} }
}, },
"node_modules/@babel/parser": { "node_modules/@babel/parser": {
"version": "7.23.0", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.3.tgz",
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "integrity": "sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==",
"dev": true, "dev": true,
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
@ -384,9 +384,9 @@
} }
}, },
"node_modules/@babel/plugin-syntax-jsx": { "node_modules/@babel/plugin-syntax-jsx": {
"version": "7.22.5", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz",
"integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.22.5" "@babel/helper-plugin-utils": "^7.22.5"
@ -399,9 +399,9 @@
} }
}, },
"node_modules/@babel/plugin-syntax-typescript": { "node_modules/@babel/plugin-syntax-typescript": {
"version": "7.22.5", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz",
"integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.22.5" "@babel/helper-plugin-utils": "^7.22.5"
@ -414,12 +414,12 @@
} }
}, },
"node_modules/@babel/plugin-transform-modules-commonjs": { "node_modules/@babel/plugin-transform-modules-commonjs": {
"version": "7.23.0", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.3.tgz",
"integrity": "sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==", "integrity": "sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-module-transforms": "^7.23.0", "@babel/helper-module-transforms": "^7.23.3",
"@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-simple-access": "^7.22.5" "@babel/helper-simple-access": "^7.22.5"
}, },
@ -431,15 +431,15 @@
} }
}, },
"node_modules/@babel/plugin-transform-typescript": { "node_modules/@babel/plugin-transform-typescript": {
"version": "7.22.15", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.23.3.tgz",
"integrity": "sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==", "integrity": "sha512-ogV0yWnq38CFwH20l2Afz0dfKuZBx9o/Y2Rmh5vuSS0YD1hswgEgTfyTzuSrT2q9btmHRSqYoSfwFUVaC1M1Jw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-annotate-as-pure": "^7.22.5", "@babel/helper-annotate-as-pure": "^7.22.5",
"@babel/helper-create-class-features-plugin": "^7.22.15", "@babel/helper-create-class-features-plugin": "^7.22.15",
"@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/plugin-syntax-typescript": "^7.22.5" "@babel/plugin-syntax-typescript": "^7.23.3"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -449,16 +449,16 @@
} }
}, },
"node_modules/@babel/preset-typescript": { "node_modules/@babel/preset-typescript": {
"version": "7.23.2", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.2.tgz", "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.3.tgz",
"integrity": "sha512-u4UJc1XsS1GhIGteM8rnGiIvf9rJpiVgMEeCnwlLA7WJPC+jcXWJAGxYmeqs5hOZD8BbAfnV5ezBOxQbb4OUxA==", "integrity": "sha512-17oIGVlqz6CchO9RFYn5U6ZpWRZIngayYCtrPRSgANSwC2V1Jb+iP74nVxzzXJte8b8BYxrL1yY96xfhTBrNNQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-validator-option": "^7.22.15", "@babel/helper-validator-option": "^7.22.15",
"@babel/plugin-syntax-jsx": "^7.22.5", "@babel/plugin-syntax-jsx": "^7.23.3",
"@babel/plugin-transform-modules-commonjs": "^7.23.0", "@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@babel/plugin-transform-typescript": "^7.22.15" "@babel/plugin-transform-typescript": "^7.23.3"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -482,19 +482,19 @@
} }
}, },
"node_modules/@babel/traverse": { "node_modules/@babel/traverse": {
"version": "7.23.2", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.3.tgz",
"integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "integrity": "sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.23.0", "@babel/generator": "^7.23.3",
"@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.23.0", "@babel/helper-function-name": "^7.23.0",
"@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-split-export-declaration": "^7.22.6",
"@babel/parser": "^7.23.0", "@babel/parser": "^7.23.3",
"@babel/types": "^7.23.0", "@babel/types": "^7.23.3",
"debug": "^4.1.0", "debug": "^4.1.0",
"globals": "^11.1.0" "globals": "^11.1.0"
}, },
@ -503,9 +503,9 @@
} }
}, },
"node_modules/@babel/types": { "node_modules/@babel/types": {
"version": "7.23.0", "version": "7.23.3",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.3.tgz",
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "integrity": "sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-string-parser": "^7.22.5", "@babel/helper-string-parser": "^7.22.5",
@ -952,17 +952,17 @@
} }
}, },
"node_modules/@solidjs/router": { "node_modules/@solidjs/router": {
"version": "0.8.3", "version": "0.9.1",
"resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.8.3.tgz", "resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.9.1.tgz",
"integrity": "sha512-oJuqQo10rVTiQYhe1qXIG1NyZIZ2YOwHnlLc8Xx+g/iJhFCJo1saLOIrD/Dkh2fpIaIny5ZMkz1cYYqoTYGJbg==", "integrity": "sha512-kRY75piOQsyoH75E/RP6lr7uVGFCjeeCCCJx7Z2D1Vc6+I1yFQjLCvE+6agXGwqDoWi6vbETP1g7gmp/L1mNLg==",
"peerDependencies": { "peerDependencies": {
"solid-js": "^1.5.3" "solid-js": "^1.8.4"
} }
}, },
"node_modules/@types/babel__core": { "node_modules/@types/babel__core": {
"version": "7.20.3", "version": "7.20.4",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.3.tgz", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.4.tgz",
"integrity": "sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==", "integrity": "sha512-mLnSC22IC4vcWiuObSRjrLd9XcBTGf59vUSoq2jkQDJ/QQ8PMI9rSuzE+aEV8karUMbskw07bKYoUJCKTUaygg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.20.7", "@babel/parser": "^7.20.7",
@ -973,18 +973,18 @@
} }
}, },
"node_modules/@types/babel__generator": { "node_modules/@types/babel__generator": {
"version": "7.6.6", "version": "7.6.7",
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.6.tgz", "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.7.tgz",
"integrity": "sha512-66BXMKb/sUWbMdBNdMvajU7i/44RkrA3z/Yt1c7R5xejt8qh84iU54yUWCtm0QwGJlDcf/gg4zd/x4mpLAlb/w==", "integrity": "sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.0.0" "@babel/types": "^7.0.0"
} }
}, },
"node_modules/@types/babel__template": { "node_modules/@types/babel__template": {
"version": "7.4.3", "version": "7.4.4",
"resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.3.tgz", "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
"integrity": "sha512-ciwyCLeuRfxboZ4isgdNZi/tkt06m8Tw6uGbBSBgWrnnZGNXiEyM27xc/PjXGQLqlZ6ylbgHMnm7ccF9tCkOeQ==", "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.1.0", "@babel/parser": "^7.1.0",
@ -992,9 +992,9 @@
} }
}, },
"node_modules/@types/babel__traverse": { "node_modules/@types/babel__traverse": {
"version": "7.20.3", "version": "7.20.4",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.3.tgz", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz",
"integrity": "sha512-Lsh766rGEFbaxMIDH7Qa+Yha8cMVI3qAK6CHt3OR0YfxOIn5Z54iHiyDRycHrBqeIiqGa20Kpsv1cavfBKkRSw==", "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.20.7" "@babel/types": "^7.20.7"
@ -1075,9 +1075,9 @@
} }
}, },
"node_modules/babel-plugin-jsx-dom-expressions": { "node_modules/babel-plugin-jsx-dom-expressions": {
"version": "0.37.2", "version": "0.37.8",
"resolved": "https://registry.npmjs.org/babel-plugin-jsx-dom-expressions/-/babel-plugin-jsx-dom-expressions-0.37.2.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-jsx-dom-expressions/-/babel-plugin-jsx-dom-expressions-0.37.8.tgz",
"integrity": "sha512-u3VKB+On86cYSLAbw9j0m0X8ZejL4MR7oG7TRlrMQ/y1mauR/ZpM2xkiOPZEUlzHLo1GYGlTdP9s5D3XuA6iSQ==", "integrity": "sha512-nVHH6g7541aaAQJAsyWHvjH7GCXZ+8tuF3Qu4y9W9aKwonRbcJL+yyMatDJLvjC54iIuGowiiZM6Rm3AVJczGg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-module-imports": "7.18.6", "@babel/helper-module-imports": "7.18.6",
@ -1103,12 +1103,12 @@
} }
}, },
"node_modules/babel-preset-solid": { "node_modules/babel-preset-solid": {
"version": "1.8.2", "version": "1.8.4",
"resolved": "https://registry.npmjs.org/babel-preset-solid/-/babel-preset-solid-1.8.2.tgz", "resolved": "https://registry.npmjs.org/babel-preset-solid/-/babel-preset-solid-1.8.4.tgz",
"integrity": "sha512-hEIy4K1CGPQwCekFJ9NV3T92fezS4GQV0SQXEGVe9dyo+7iI7Fjuu6OKIdE5z/S4IfMEL6gCU+1AZ3yK6PnGMg==", "integrity": "sha512-TfI09EOFHsbhVqoM+svop3zY4zOUIBlZsGU16Rgd4NsYVXw6lv2VEn7dmlpczMMQy0IeO3PFiXlMQZWutB+uAQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"babel-plugin-jsx-dom-expressions": "^0.37.2" "babel-plugin-jsx-dom-expressions": "^0.37.8"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
@ -1193,9 +1193,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001550", "version": "1.0.30001561",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001550.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz",
"integrity": "sha512-p82WjBYIypO0ukTsd/FG3Xxs+4tFeaY9pfT4amQL8KWtYH7H9nYwReGAbMTJ0hsmRO8IfDtsS6p3ZWj8+1c2RQ==", "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -1280,12 +1280,6 @@
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true "dev": true
}, },
"node_modules/colord": {
"version": "2.9.3",
"resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",
"integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==",
"dev": true
},
"node_modules/commander": { "node_modules/commander": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@ -1334,17 +1328,25 @@
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
"integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
}, },
"node_modules/culori": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/culori/-/culori-3.2.0.tgz",
"integrity": "sha512-HIEbTSP7vs1mPq/2P9In6QyFE0Tkpevh0k9a+FkjhD+cwsYm9WRSbn4uMdW9O0yXlNYC3ppxL3gWWPOcvEl57w==",
"dev": true,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
}
},
"node_modules/daisyui": { "node_modules/daisyui": {
"version": "3.9.3", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-3.9.3.tgz", "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.0.1.tgz",
"integrity": "sha512-8li177QCu6dqlEOzE3h/dAV1y9Movbjx5bzJIO/hNqMNZtJkbHM0trjTzbDejV7N57eNGdjBvAGtxZYKzS4jow==", "integrity": "sha512-ImgJOvcWjcK7jepOeP3T/WQZQ/kRF2YCwQPGIjto5URjdMhcr1xOctOZUz50/CYlAI2nYKJ1Y3r+Iznk0hMFCA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"colord": "^2.9",
"css-selector-tokenizer": "^0.8", "css-selector-tokenizer": "^0.8",
"postcss": "^8", "culori": "^3",
"postcss-js": "^4", "picocolors": "^1",
"tailwindcss": "^3.1" "postcss-js": "^4"
}, },
"engines": { "engines": {
"node": ">=16.9.0" "node": ">=16.9.0"
@ -1384,9 +1386,9 @@
"dev": true "dev": true
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.558", "version": "1.4.581",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.558.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz",
"integrity": "sha512-j9IcGmfkyN5MBH/0Xzg45GDHasXsnwEJDM6Xnr9H7GlGUni+JH4q6xp6Nk7NV5LjTmoEFBqhILIqg1McJrv6uA==", "integrity": "sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw==",
"dev": true "dev": true
}, },
"node_modules/esbuild": { "node_modules/esbuild": {
@ -1445,9 +1447,9 @@
} }
}, },
"node_modules/fast-glob": { "node_modules/fast-glob": {
"version": "3.3.1", "version": "3.3.2",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
"integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.stat": "^2.0.2",
@ -1532,6 +1534,15 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gensync": { "node_modules/gensync": {
"version": "1.0.0-beta.2", "version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
@ -1582,15 +1593,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/has": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
"integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
"dev": true,
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/has-flag": { "node_modules/has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
@ -1600,6 +1602,18 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/hasown": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/html-entities": { "node_modules/html-entities": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",
@ -1635,12 +1649,12 @@
} }
}, },
"node_modules/is-core-module": { "node_modules/is-core-module": {
"version": "2.13.0", "version": "2.13.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
"integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"has": "^1.0.3" "hasown": "^2.0.0"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
@ -1677,9 +1691,9 @@
} }
}, },
"node_modules/is-what": { "node_modules/is-what": {
"version": "4.1.15", "version": "4.1.16",
"resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.15.tgz", "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz",
"integrity": "sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==", "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=12.13" "node": ">=12.13"
@ -1689,9 +1703,9 @@
} }
}, },
"node_modules/jiti": { "node_modules/jiti": {
"version": "1.20.0", "version": "1.21.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.20.0.tgz", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz",
"integrity": "sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==", "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"jiti": "bin/jiti.js" "jiti": "bin/jiti.js"
@ -1818,9 +1832,9 @@
} }
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.6", "version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -2194,20 +2208,20 @@
} }
}, },
"node_modules/seroval": { "node_modules/seroval": {
"version": "0.11.6", "version": "0.12.3",
"resolved": "https://registry.npmjs.org/seroval/-/seroval-0.11.6.tgz", "resolved": "https://registry.npmjs.org/seroval/-/seroval-0.12.3.tgz",
"integrity": "sha512-Lhy+94CNcNza6d0vM4sQKLsaLaX39q0ELqIBc7DkdiFljI8Q387Yb+xKgLxRWXs7uuHRu/ZcJ64xfVJ0Bj4LPg==", "integrity": "sha512-5WDeMpv7rmEylsypRj1iwRVHE/QLsMLiZ+9savlNNQEVdgGia1iRMb7qyaAagY0wu/7+QTe6d2wldk/lgaLb6g==",
"engines": { "engines": {
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/solid-js": { "node_modules/solid-js": {
"version": "1.8.3", "version": "1.8.5",
"resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.8.3.tgz", "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.8.5.tgz",
"integrity": "sha512-S7ztgPI6X4tUaWmhZe3aDx0E9F6FGxXVU8NsocrPqqUbxHoFi8eTPlDMcenOlXuo2ITQ97j2URaj0StfJci4KQ==", "integrity": "sha512-xvtJvzJzWbsn35oKFhW9kNwaxG1Z/YLMsDp4tLVcYZTMPzvzQ8vEZuyDQ6nt7xDArVgZJ7TUFrJUwrui/oq53A==",
"dependencies": { "dependencies": {
"csstype": "^3.1.0", "csstype": "^3.1.0",
"seroval": "^0.11.6" "seroval": "^0.12.0"
} }
}, },
"node_modules/solid-refresh": { "node_modules/solid-refresh": {
@ -2280,9 +2294,9 @@
} }
}, },
"node_modules/tailwindcss": { "node_modules/tailwindcss": {
"version": "3.3.3", "version": "3.3.5",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz",
"integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==", "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@alloc/quick-lru": "^5.2.0", "@alloc/quick-lru": "^5.2.0",
@ -2290,10 +2304,10 @@
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"didyoumean": "^1.2.2", "didyoumean": "^1.2.2",
"dlv": "^1.1.3", "dlv": "^1.1.3",
"fast-glob": "^3.2.12", "fast-glob": "^3.3.0",
"glob-parent": "^6.0.2", "glob-parent": "^6.0.2",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
"jiti": "^1.18.2", "jiti": "^1.19.1",
"lilconfig": "^2.1.0", "lilconfig": "^2.1.0",
"micromatch": "^4.0.5", "micromatch": "^4.0.5",
"normalize-path": "^3.0.0", "normalize-path": "^3.0.0",
@ -2535,9 +2549,9 @@
"dev": true "dev": true
}, },
"node_modules/yaml": { "node_modules/yaml": {
"version": "2.3.3", "version": "2.3.4",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
"integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">= 14" "node": ">= 14"

View file

@ -9,17 +9,17 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@solidjs/router": "^0.8.3", "@solidjs/router": "^0.9.1",
"solid-js": "^1.7.8" "solid-js": "^1.8.5"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"daisyui": "^3.9.3", "daisyui": "^4.0.1",
"postcss": "^8.4.31", "postcss": "^8.4.31",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.5",
"typescript": "^5.0.2", "typescript": "^5.2.2",
"vite": "^4.4.5", "vite": "^4.5.0",
"vite-plugin-qrcode": "^0.2.2", "vite-plugin-qrcode": "^0.2.2",
"vite-plugin-solid": "^2.7.0" "vite-plugin-solid": "^2.7.2"
} }
} }

View file

@ -0,0 +1,17 @@
export function Arrow() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" />
</svg>
);
}

View file

@ -0,0 +1,67 @@
import { onCleanup, useContext } from "solid-js";
import { ModalContext } from "./Root";
import { LoginForm } from "./RegLogin/Login";
import { RegisterForm } from "./RegLogin/Register";
export function LoginModal() {
const modal_ctx = useContext(ModalContext);
if (!modal_ctx) {
// Handle the case where ModalContext is not available
return null;
}
const closeModal = () => {
modal_ctx.setLoginModalOpen(false);
};
// Close the modal when the component is unmounted
onCleanup(() => {
modal_ctx.setLoginModalOpen(false);
});
return (
<>
{modal_ctx.loginModalOpen() && (
<dialog class="modal modal-open">
<div class="modal-box">
<form method="dialog">
<button
onclick={closeModal}
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
>
</button>
</form>
<h3 class="font-bold text-lg mb-2">Welcome!</h3>
<div class="tabs tabs-lifted">
<input
type="radio"
name="login_tabs"
class="tab"
aria-label="Login"
checked
/>
<div class="tab-content bg-base-100 border-base-300 rounded-box p-10">
<LoginForm />
</div>
<input
type="radio"
name="login_tabs"
class="tab"
aria-label="Register"
/>
<div class="tab-content bg-base-100 border-base-300 rounded-box p-10">
<RegisterForm />
</div>
</div>
</div>
<form method="dialog" class="modal-backdrop">
<button onclick={closeModal}>close</button>
</form>
</dialog>
)}
</>
);
}

View file

@ -2,26 +2,23 @@ import { useContext } from "solid-js";
import { A } from "@solidjs/router"; import { A } from "@solidjs/router";
import { LoginContext } from "./Root"; import { LoginContext } from "./Root";
import { ModalContext } from "./Root"; import { ModalContext } from "./Root";
import { LoginForm } from "./Login";
function MenuItem(props: { href: string; children: any }) {
return (
<li>
<A class="justify-center" href={props.href} end>
{props.children}
</A>
</li>
);
}
function Menu() { function Menu() {
let login_ctx = useContext(LoginContext); let login_ctx = useContext(LoginContext);
return ( return (
<ul class="menu menu-horizontal bg-base-100 rounded-box space-x-2"> <ul class="menu md:menu-horizontal rounded-box">
<li> <MenuItem href="/">Home</MenuItem>
<A href="/" end> {login_ctx?.token() != "" && <MenuItem href="/new">New Post</MenuItem>}
Home
</A>
</li>
{login_ctx?.token() != "" ? (
<li>
<A href="/new" end>
New
</A>
</li>
) : (
<></>
)}
</ul> </ul>
); );
} }
@ -30,61 +27,42 @@ export function Navbar() {
let modal_ctx = useContext(ModalContext); let modal_ctx = useContext(ModalContext);
let login_ctx = useContext(LoginContext); let login_ctx = useContext(LoginContext);
const logout = () => {
localStorage.setItem("token", "");
localStorage.setItem("username", "");
login_ctx?.setToken("");
login_ctx?.setUsername("");
};
// Capitalize the first letter of the username
const username =
login_ctx && login_ctx.username()
? login_ctx.username().charAt(0).toUpperCase() +
login_ctx.username().slice(1)
: "Guest";
return ( return (
<div class="navbar text-neutral-content max-w-3xl max-w"> <div class="navbar text-neutral-content max-w-3xl max-w rounded-box my-4">
<div class="flex-1"> <div class="flex-1">
<A href={"/"} class="btn btn-ghost normal-case text-xl"> <A href={"/"} class="btn btn-ghost normal-case text-xl">
FrostByte FrostByte
</A> </A>
</div> </div>
<div class="hidden md:flex"> <div class="flex">
<Menu /> <Menu />
</div> </div>
<div class="flex-1 justify-end hidden md:flex"> <div class="flex-1 justify-end flex">
<A <A
href="#" href="#"
class="btn btn-ghost normal-case text-sm" class="btn btn-ghost normal-case text-sm"
onClick={() => { onClick={() => {
if (login_ctx?.token() != "") { if (login_ctx?.token() != "") logout();
localStorage.setItem("token", ""); else modal_ctx?.setLoginModalOpen(true);
localStorage.setItem("username", "");
login_ctx?.setToken("");
login_ctx?.setUsername("");
return;
}
modal_ctx?.setLoginModalOpen(true);
}} }}
> >
{login_ctx?.token() != "" ? login_ctx?.username() : "Login"} {login_ctx?.token() != "" ? username : "Login"}
</A> </A>
</div> </div>
</div> </div>
); );
} }
// This is a modal
export function Login() {
const modal_ctx = useContext(ModalContext);
return (
<dialog id="login_modal" class="modal" open={modal_ctx?.loginModalOpen()}>
<div class="modal-box">
<h3 class="font-bold text-lg">Hello!</h3>
<p class="py-4">Login to your FrostByte account.</p>
<LoginForm />
</div>
<form
method="dialog"
// This backdrop renders choppy on my machine. Likely because of the blur filter or misuse of css transisions
class="modal-backdrop backdrop-brightness-50 backdrop-blur-sm backdrop-contrast-100 transition-all transition-300"
onsubmit={(e) => {
// This is just needed to set the state to false
// The modal will close itself without this code, but without setting the state
e.preventDefault();
modal_ctx?.setLoginModalOpen(false);
}}
>
<button>close</button>
</form>
</dialog>
);
}

View file

@ -2,6 +2,7 @@ import { createSignal } from "solid-js";
import { getPosts } from "./api"; import { getPosts } from "./api";
import { Post } from "./api"; import { Post } from "./api";
import { useNavigate } from "@solidjs/router"; import { useNavigate } from "@solidjs/router";
import { Arrow } from "./Icons";
export function Posts() { export function Posts() {
const [posts, setPosts] = createSignal([] as Post[]); const [posts, setPosts] = createSignal([] as Post[]);
@ -13,17 +14,15 @@ export function Posts() {
}); });
return ( return (
<div class="flex flex-col space-y-2 w-full md:w-96"> <>
{loading() ? ( {loading() && (
<span class="loading loading-spinner loading-lg self-center"></span> <span class="loading loading-spinner loading-lg self-center"></span>
) : (
<></>
)} )}
{posts().map((post) => { {posts().map((post) => {
if (post.content == "") return; // Filtering out empty posts, remove this later if (post.content == "") return; // Filtering out empty posts, remove this later
return <PostSegment post={post}></PostSegment>; return <PostSegment post={post}></PostSegment>;
})} })}
</div> </>
); );
} }
@ -31,13 +30,17 @@ export function Posts() {
export function PostSegment({ post }: { post: Post }) { export function PostSegment({ post }: { post: Post }) {
const nav = useNavigate(); const nav = useNavigate();
return ( return (
<div <div class="card border-b-2 flex-grow border-b-base-300 bg-base-200 hover:bg-base-300 compact text-base-content w-full">
onClick={() => nav("/post/" + post?.id)}
class="card bg-base-200 shadow-lg compact text-base-content w-full"
>
<div class="card-body"> <div class="card-body">
<p class="text-base-content break-words">{post?.content}</p> <p class="text-base-content break-words">{post?.content}</p>
<div class="card-actions justify-end">
<button onClick={() => nav("/post/" + post?.id)} class="btn btn-xs">
<Arrow />
</button>
</div>
</div> </div>
</div> </div>
); );
} }

View file

@ -1,5 +1,5 @@
import { createSignal, useContext } from "solid-js"; import { createSignal, useContext } from "solid-js";
import { LoginContext, ModalContext } from "./Root"; import { LoginContext, ModalContext } from "../Root";
export function LoginForm() { export function LoginForm() {
const modal_ctx = useContext(ModalContext); const modal_ctx = useContext(ModalContext);
@ -17,49 +17,49 @@ export function LoginForm() {
}, 1000); }, 1000);
} }
return ( async function loginPress(e: Event) {
<form class="form-control"> e.preventDefault();
<label class="label">
<span class="label-text">Username</span>
</label>
<input
type="text"
placeholder="username"
value={username()}
class="input input-bordered"
onChange={(e) => {
setUsername(e.target.value);
}} />
<label class="label">
<span class="label-text">Password</span>
</label>
<input
type="password"
placeholder="password"
value={password()}
class="input input-bordered"
onChange={(e) => {
setPassword(e.target.value);
}} />
<button
class={"btn btn-primary mt-4" + (error() ? " btn-error" : "")}
onClick={(b) => {
b.preventDefault();
setWaiting(true); setWaiting(true);
submitLogin(username(), password()).then((token) => { submitLogin(username(), password()).then((token) => {
if (token != "") { if (token != "") {
setWaiting(false); setWaiting(false);
setError(false); setError(false);
login_ctx?.setUsername(username()); login_ctx?.setUsername(username());
setUsername("");
setPassword("");
login_ctx?.setToken(token); login_ctx?.setToken(token);
modal_ctx?.setLoginModalOpen(false); modal_ctx?.setLoginModalOpen(false);
setUsername("");
setPassword("");
} else { } else {
loginFailed(); loginFailed();
} }
}); });
}
return (
<form class="form-control space-y-2">
<input
type="text"
placeholder="Username"
value={username()}
class="input input-bordered"
onChange={(e) => {
setUsername(e.target.value);
}} }}
/>
<input
type="password"
placeholder="Password"
value={password()}
class="input input-bordered"
onChange={(e) => {
setPassword(e.target.value);
}}
/>
<button
class={"btn btn-primary" + (error() ? " btn-error" : "")}
onClick={ loginPress }
> >
{waiting() ? "Logging in..." : "Login"} {waiting() ? "Logging in..." : "Login"}
</button> </button>
@ -73,6 +73,7 @@ export async function submitLogin(
username: string, username: string,
password: string password: string
): Promise<string> { ): Promise<string> {
if(username == "" || password == "") return "";
const response = await fetch("/api/login", { const response = await fetch("/api/login", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@ -89,4 +90,3 @@ export async function submitLogin(
} }
return ""; return "";
} }

View file

@ -0,0 +1,103 @@
import { createSignal, useContext } from "solid-js";
import { LoginContext, ModalContext } from "../Root";
export function RegisterForm() {
const modal_ctx = useContext(ModalContext);
const login_ctx = useContext(LoginContext);
const [username, setUsername] = createSignal<string>("");
const [password, setPassword] = createSignal<string>("");
const [captcha, setCaptcha] = createSignal<string>("");
const [waiting, setWaiting] = createSignal(false);
const [error, setError] = createSignal(false);
async function loginFailed() {
setError(true);
setWaiting(false);
setTimeout(() => {
setError(false);
}, 1000);
}
async function regPress(e: Event) {
e.preventDefault();
setWaiting(true);
submitRegistration(username(), password(), captcha()).then((token) => {
if (token != "") {
setWaiting(false);
setError(false);
login_ctx?.setUsername(username());
login_ctx?.setToken(token);
modal_ctx?.setLoginModalOpen(false);
setUsername("");
setPassword("");
} else {
loginFailed();
}
});
}
return (
<form class="form-control space-y-2">
<input
type="text"
placeholder="Username"
value={username()}
class="input input-bordered"
onChange={(e) => {
setUsername(e.target.value);
}}
/>
<input
type="password"
placeholder="Password"
value={password()}
class="input input-bordered"
onChange={(e) => {
setPassword(e.target.value);
}}
/>
<input
type="text"
placeholder="Captcha"
value={password()}
class="input input-bordered"
onChange={(e) => {
setCaptcha(e.target.value);
}}
/>
<button
class={"btn btn-primary" + (error() ? " btn-error" : "")}
onClick={regPress}
>
{waiting() ? "Logging in..." : "Login"}
</button>
</form>
);
}
// This function is responsible for sending the login request to the server
// and storing the token in localstorage
export async function submitRegistration(
username: string,
password: string,
captcha: string
): Promise<string> {
const response = await fetch("/api/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password, captcha }),
});
if (response.ok) {
const data = await response.json();
if (data.token && data.username) {
localStorage.setItem("token", data.token);
localStorage.setItem("username", data.username);
return data.token;
}
}
return "";
}

View file

@ -5,7 +5,8 @@ import { createPost } from "./api";
import { NewPost } from "./api"; import { NewPost } from "./api";
import { Navbar } from "./Navbar"; import { Navbar } from "./Navbar";
import { Primary } from "./Primary"; import { Primary } from "./Primary";
import { Login } from "./Navbar"; // import { Login } from "./Navbar";
import { LoginModal } from "./LoginModal";
import { useNavigate } from "@solidjs/router"; import { useNavigate } from "@solidjs/router";
// Representing the state of varoious modals. // Representing the state of varoious modals.
@ -44,9 +45,9 @@ function Root() {
<LoginContext.Provider <LoginContext.Provider
value={{ token, setToken, username, setUsername }} value={{ token, setToken, username, setUsername }}
> >
<div class="flex flex-col items-center my-2"> <div class="flex flex-col items-center">
<Navbar /> <Navbar />
<Login /> <LoginModal />
<div class="flex flex-col items-center md:w-96 space-y-2"> <div class="flex flex-col items-center md:w-96 space-y-2">
<Primary /> <Primary />
</div> </div>
@ -66,10 +67,12 @@ export function NewPostInputArea() {
const sendPost = () => { const sendPost = () => {
setWaiting(true); setWaiting(true);
const response = createPost({ const response = createPost({
content: content(), content: content(),
token: login_ctx?.token(), token: login_ctx?.token(),
} as NewPost); } as NewPost);
if (response) { if (response) {
response.then(() => { response.then(() => {
setWaiting(false); setWaiting(false);

View file

@ -9,11 +9,9 @@ export function SinglePost() {
return ( return (
<Suspense fallback={<div>Some loading message</div>}> <Suspense fallback={<div>Some loading message</div>}>
<div>
<Show when={post()}> <Show when={post()}>
<PostSegment post={post()!}></PostSegment> <PostSegment post={post()!}></PostSegment>
</Show> </Show>
</div>
</Suspense> </Suspense>
); );
} }

View file

@ -29,7 +29,6 @@ export async function getPost(id: string): Promise<Post> {
} }
export async function createPost(post: NewPost): Promise<void> { export async function createPost(post: NewPost): Promise<void> {
// await fetch(`${API_URL}`, {
await fetch("/api/posts", { await fetch("/api/posts", {
method: "POST", method: "POST",
headers: { headers: {