Skip to content
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

Refactor example frontend to F# with JSX support #41

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
aa7dd44
Update deps & switch to interpolated strings before refactoring
delneg Oct 14, 2022
58111ce
WIP
delneg Oct 14, 2022
d6b4bac
Switch to Vite
delneg Oct 14, 2022
91c9eef
WIP States & Elmish
delneg Oct 14, 2022
606467d
Added inputs, MessageList to right panel, added stub 'update' function
delneg Oct 14, 2022
d127c80
Added css imports
delneg Oct 14, 2022
077fb2f
Delete unneeded import
delneg Oct 14, 2022
049c52e
Added "PopUp" tor right-panel, fix errors, fix bg.jpg
delneg Oct 15, 2022
396bb40
Added some basic commands in 'update', remove old "State" type, added…
delneg Oct 15, 2022
1901c4e
Sidebar first impl, switch vite to 127.0.0.1 instead of localhost
delneg Oct 15, 2022
f3b9caf
Fix sidebar
delneg Oct 15, 2022
7afb72d
Throttle shenanigans
delneg Oct 15, 2022
6e2c75b
Implement "performFileUpload"
delneg Oct 15, 2022
f962f79
SetMsgIdAsRead & PerformSendingMessage
delneg Oct 15, 2022
218b510
Implemented MessageIdChanged & UnreadCountChanged
delneg Oct 15, 2022
d68f884
Implement "change online pk's"
delneg Oct 15, 2022
7dfc51c
Implement AddTyping
delneg Oct 15, 2022
2f30b39
Added SelectDialog fn
delneg Oct 15, 2022
e2c455f
Fix ChatItem name clashing
delneg Oct 15, 2022
c4d78d2
Implement localSearch
delneg Oct 15, 2022
6f641e6
Implemented AddMesage
delneg Oct 15, 2022
c2a18a5
Add remaining messages & websocket stuff
delneg Oct 16, 2022
a501f2b
WIP begin debugging
delneg Oct 16, 2022
723fd29
Fix vite bundling, constant names for js / css / resources, enable so…
delneg Oct 17, 2022
1168109
Fix websocket update loop via React.useEffect, added Elmish loop logg…
delneg Oct 18, 2022
4b7507e
Fix UsersLoading, fix PopUp "new chat"
delneg Oct 18, 2022
40567f3
Don't send empty messages, filter chats by date, useMemo for chats
delneg Oct 18, 2022
bc2f49e
Remove old popup
delneg Oct 18, 2022
d821f8f
Update index.js
delneg Oct 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/frontend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "3.1.7",
"version": "4.0.0-theta-011",
"commands": [
"fable"
]
Expand Down
22 changes: 22 additions & 0 deletions example/frontend/App.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="src/Utils.fs" />
<Compile Include="src/Types.fs" />
<Compile Include="src/Logic.fs" />
<Compile Include="src/App.fs" />
<Compile Include="src/Index.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fable.React.UseElmish" Version="1.0.0-beta-001" />
<PackageReference Include="Feliz" Version="2.0.0-prerelease-003" />
<PackageReference Include="Fable.Browser.Url" Version="1.0.3" />
<PackageReference Include="Fable.Browser.WebSocket" Version="1.2.0" />
<PackageReference Include="Fable.Core" Version="4.0.0-theta-006" />
<PackageReference Include="Fable.Browser.Dom" Version="2.10.1" />
<PackageReference Include="Fable.Fetch" Version="2.6.0" />
<PackageReference Include="Thoth.Json" Version="6.0.0" />
</ItemGroup>
</Project>
18 changes: 0 additions & 18 deletions example/frontend/fs-src/App.fsproj

This file was deleted.

43 changes: 0 additions & 43 deletions example/frontend/fs-src/Utils.fs

This file was deleted.

6 changes: 6 additions & 0 deletions example/frontend/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "6.0.2",
"rollForward": "minor"
}
}
18 changes: 5 additions & 13 deletions example/frontend/public/index.html → example/frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="manifest" href="/manifest.json" />
<title>Django Private Chat2 Example</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="./dist/src/Index.jsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
37 changes: 16 additions & 21 deletions example/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,30 @@
"version": "0.1.0",
"private": true,
"devDependencies": {
"@svgr/webpack": "^5.5.0",
"css-loader": "^3.6.0",
"esbuild-loader": "^2.9.2",
"file-loader": "^4.3.0",
"identicon.js": "^2.3.3",
"lorem-ipsum": "^1.0.4",
"mini-css-extract-plugin": "^0.12.0",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"style-loader": "^1.3.0",
"url-loader": "^2.3.0",
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "^3.11.2"
"@vitejs/plugin-legacy": "^2.2.0",
"@vitejs/plugin-react": "^2.1.0",
"@babel/core": "^7.19.3",
"terser": "^5.15.1",
"lorem-ipsum": "^2.0.8",
"vite": "^3.1.8",
"vite-plugin-svgr": "^2.2.2",
"react-chat-elements": "^12.0.5"
},
"dependencies": {
"lodash.throttle": "^4.1.1",
"react": "^16.14.0",
"react-chat-elements": "^10.14.0",
"react-dom": "^16.14.0",
"react-icons": "^4.2.0",
"react-toastify": "^7.0.3",
"identicon.js": "^2.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
"react-toastify": "^9.0.8",
"reconnecting-websocket": "^4.4.0",
"timeago.js": "^4.0.2"
},
"scripts": {
"postinstall": "dotnet tool restore",
"start:fable": "dotnet fable watch fs-src",
"start": "dotnet fable watch fs-src --run webpack serve --mode development --config webpack.config.js --progress --profile --content-base src/",
"build": "dotnet fable fs-src --run webpack --mode production",
"start:fable": "dotnet fable watch .",
"start": "dotnet fable watch . -o dist -e .jsx --run vite serve",
"build": "dotnet fable -s . -o dist -e .jsx --run vite build",
"build:jsonly": "webpack --mode production --watch"
},
"browserslist": {
Expand Down
Loading