Skip to content

Commit

Permalink
Renaming to mapcanv
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyabo committed Sep 2, 2024
1 parent 7faec16 commit 27224c0
Show file tree
Hide file tree
Showing 41 changed files with 203 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ erl_crash.dump
/tmp/

# Ignore package tarball (built via "mix hex.build").
collaborative_drawing-*.tar
mapcanv-*.tar

# Ignore assets that are produced by build tools.
/priv/static/assets/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ RUN chown nobody /app
ENV MIX_ENV="prod"

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/collaborative_drawing ./
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/mapcanv ./

USER nobody

Expand Down
8 changes: 4 additions & 4 deletions assets/js/user_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Bring in Phoenix channels client library:
import {Socket} from "phoenix";

// And connect to the path in "lib/collaborative_drawing_web/endpoint.ex". We pass the
// And connect to the path in "lib/mapcanv_web/endpoint.ex". We pass the
// token for authentication. Read below how it should be used.
export let socket = new Socket("/socket", {params: {token: window.userToken}});

Expand All @@ -14,7 +14,7 @@ export let socket = new Socket("/socket", {params: {token: window.userToken}});
// If the current user exists you can assign the user's token in
// the connection for use in the layout.
//
// In your "lib/collaborative_drawing_web/router.ex":
// In your "lib/mapcanv_web/router.ex":
//
// pipeline :browser do
// ...
Expand All @@ -32,12 +32,12 @@ export let socket = new Socket("/socket", {params: {token: window.userToken}});
// end
//
// Now you need to pass this token to JavaScript. You can do so
// inside a script tag in "lib/collaborative_drawing_web/templates/layout/app.html.heex":
// inside a script tag in "lib/mapcanv_web/templates/layout/app.html.heex":
//
// <script>window.userToken = "<%= assigns[:user_token] %>";</script>
//
// You will need to verify the user token in the "connect/3" function
// in "lib/collaborative_drawing_web/channels/user_socket.ex":
// in "lib/mapcanv_web/channels/user_socket.ex":
//
// def connect(%{"token" => token}, socket, _connect_info) do
// # max_age: 1209600 is equivalent to two weeks in seconds
Expand Down
134 changes: 67 additions & 67 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,128 +1,128 @@
// See the Tailwind configuration guide for advanced usage
// https://tailwindcss.com/docs/configuration

const {fontFamily} = require('tailwindcss/defaultTheme');
const {fontFamily} = require("tailwindcss/defaultTheme");

const plugin = require('tailwindcss/plugin');
const fs = require('fs');
const path = require('path');
const plugin = require("tailwindcss/plugin");
const fs = require("fs");
const path = require("path");

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./js/**/*.js',
'./js/**/*.ts',
'./js/**/*.tsx',
'../lib/collaborative_drawing_web.ex',
'../lib/collaborative_drawing_web/**/*.*ex',
"./js/**/*.js",
"./js/**/*.ts",
"./js/**/*.tsx",
"../lib/mapcanv_web.ex",
"../lib/mapcanv_web/**/*.*ex",
],
theme: {
extend: {
colors: {
brand: '#FD4F00',
border: 'hsl(var(--border))',
input: 'hsl(var(--input))',
ring: 'hsl(var(--ring))',
background: 'hsl(var(--background))',
foreground: 'hsl(var(--foreground))',
brand: "#FD4F00",
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: 'hsl(var(--primary))',
foreground: 'hsl(var(--primary-foreground))',
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: 'hsl(var(--secondary))',
foreground: 'hsl(var(--secondary-foreground))',
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: 'hsl(var(--destructive))',
foreground: 'hsl(var(--destructive-foreground))',
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: 'hsl(var(--muted))',
foreground: 'hsl(var(--muted-foreground))',
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: 'hsl(var(--accent))',
foreground: 'hsl(var(--accent-foreground))',
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
popover: {
DEFAULT: 'hsl(var(--popover))',
foreground: 'hsl(var(--popover-foreground))',
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: 'hsl(var(--card))',
foreground: 'hsl(var(--card-foreground))',
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},
borderRadius: {
lg: `var(--radius)`,
md: `calc(var(--radius) - 2px)`,
sm: 'calc(var(--radius) - 4px)',
sm: "calc(var(--radius) - 4px)",
},
fontFamily: {
sans: [...fontFamily.sans],
},
keyframes: {
'accordion-down': {
from: {height: '0'},
to: {height: 'var(--radix-accordion-content-height)'},
"accordion-down": {
from: {height: "0"},
to: {height: "var(--radix-accordion-content-height)"},
},
'accordion-up': {
from: {height: 'var(--radix-accordion-content-height)'},
to: {height: '0'},
"accordion-up": {
from: {height: "var(--radix-accordion-content-height)"},
to: {height: "0"},
},
},
animation: {
'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out',
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [
require('tailwindcss-animate'),
require('@tailwindcss/forms'),
require("tailwindcss-animate"),
require("@tailwindcss/forms"),
// Allows prefixing tailwind classes with LiveView classes to add rules
// only when LiveView classes are applied, for example:
//
// <div class="phx-click-loading:animate-ping">
//
plugin(({addVariant}) =>
addVariant('phx-no-feedback', ['.phx-no-feedback&', '.phx-no-feedback &'])
addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])
),
plugin(({addVariant}) =>
addVariant('phx-click-loading', [
'.phx-click-loading&',
'.phx-click-loading &',
addVariant("phx-click-loading", [
".phx-click-loading&",
".phx-click-loading &",
])
),
plugin(({addVariant}) =>
addVariant('phx-submit-loading', [
'.phx-submit-loading&',
'.phx-submit-loading &',
addVariant("phx-submit-loading", [
".phx-submit-loading&",
".phx-submit-loading &",
])
),
plugin(({addVariant}) =>
addVariant('phx-change-loading', [
'.phx-change-loading&',
'.phx-change-loading &',
addVariant("phx-change-loading", [
".phx-change-loading&",
".phx-change-loading &",
])
),

// Embeds Heroicons (https://heroicons.com) into your app.css bundle
// See your `CoreComponents.icon/1` for more information.
//
plugin(function ({matchComponents, theme}) {
let iconsDir = path.join(__dirname, '../deps/heroicons/optimized');
let iconsDir = path.join(__dirname, "../deps/heroicons/optimized");
let values = {};
let icons = [
['', '/24/outline'],
['-solid', '/24/solid'],
['-mini', '/20/solid'],
['-micro', '/16/solid'],
["", "/24/outline"],
["-solid", "/24/solid"],
["-mini", "/20/solid"],
["-micro", "/16/solid"],
];
icons.forEach(([suffix, dir]) => {
fs.readdirSync(path.join(iconsDir, dir)).forEach((file) => {
let name = path.basename(file, '.svg') + suffix;
let name = path.basename(file, ".svg") + suffix;
values[name] = {name, fullPath: path.join(iconsDir, dir, file)};
});
});
Expand All @@ -132,21 +132,21 @@ module.exports = {
let content = fs
.readFileSync(fullPath)
.toString()
.replace(/\r?\n|\r/g, '');
let size = theme('spacing.6');
if (name.endsWith('-mini')) {
size = theme('spacing.5');
} else if (name.endsWith('-micro')) {
size = theme('spacing.4');
.replace(/\r?\n|\r/g, "");
let size = theme("spacing.6");
if (name.endsWith("-mini")) {
size = theme("spacing.5");
} else if (name.endsWith("-micro")) {
size = theme("spacing.4");
}
return {
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
'-webkit-mask': `var(--hero-${name})`,
"-webkit-mask": `var(--hero-${name})`,
mask: `var(--hero-${name})`,
'mask-repeat': 'no-repeat',
'background-color': 'currentColor',
'vertical-align': 'middle',
display: 'inline-block',
"mask-repeat": "no-repeat",
"background-color": "currentColor",
"vertical-align": "middle",
display: "inline-block",
width: size,
height: size,
};
Expand Down
14 changes: 7 additions & 7 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
# General application configuration
import Config

config :collaborative_drawing,
config :mapcanv,
generators: [timestamp_type: :utc_datetime]

# Configures the endpoint
config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
config :mapcanv, MapCanvWeb.Endpoint,
url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: CollaborativeDrawingWeb.ErrorHTML, json: CollaborativeDrawingWeb.ErrorJSON],
formats: [html: MapCanvWeb.ErrorHTML, json: MapCanvWeb.ErrorJSON],
layout: false
],
pubsub_server: CollaborativeDrawing.PubSub,
pubsub_server: MapCanv.PubSub,
live_view: [signing_salt: "U4/2nfRM"]

# Configures the mailer
Expand All @@ -28,12 +28,12 @@ config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :collaborative_drawing, CollaborativeDrawing.Mailer, adapter: Swoosh.Adapters.Local
config :mapcanv, MapCanv.Mailer, adapter: Swoosh.Adapters.Local

# Configure esbuild (the version is required)
config :esbuild,
version: "0.17.11",
collaborative_drawing: [
mapcanv: [
args:
# TODO: target es2022 might be too high for some browsers, consider changing it to es2017
# es2022 was chosen to avoid loader.gl build errors
Expand All @@ -45,7 +45,7 @@ config :esbuild,
# Configure tailwind (the version is required)
config :tailwind,
version: "3.4.0",
collaborative_drawing: [
mapcanv: [
args: ~w(
--config=tailwind.config.js
--input=css/app.css
Expand Down
12 changes: 6 additions & 6 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Config
# The watchers configuration can be used to run external
# watchers to your application. For example, we can use it
# to bundle .js and .css sources.
config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
config :mapcanv, MapCanvWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000],
Expand All @@ -16,8 +16,8 @@ config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
secret_key_base: "cmvnlKtC1gpcmRq64004qjKcNt0VWAM5ncSOUnlatWA99ceICUV36ouckuk2at/8",
watchers: [
esbuild:
{Esbuild, :install_and_run, [:collaborative_drawing, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:collaborative_drawing, ~w(--watch)]}
{Esbuild, :install_and_run, [:mapcanv, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:mapcanv, ~w(--watch)]}
]

# ## SSL Support
Expand All @@ -44,17 +44,17 @@ config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
# different ports.

# Watch static and templates for browser reloading.
config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
config :mapcanv, MapCanvWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/collaborative_drawing_web/(controllers|live|components)/.*(ex|heex)$"
~r"lib/mapcanv_web/(controllers|live|components)/.*(ex|heex)$"
]
]

# Enable dev routes for dashboard and mailbox
config :collaborative_drawing, dev_routes: true
config :mapcanv, dev_routes: true

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
Expand Down
8 changes: 4 additions & 4 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import Config
# manifest is generated by the `mix assets.deploy` task,
# which you should run after static files are built and
# before starting your production server.
config :collaborative_drawing, CollaborativeDrawingWeb.Endpoint,
config :mapcanv, MapCanvWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json"

# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: CollaborativeDrawing.Finch
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: MapCanv.Finch

# Disable Swoosh Local Memory Storage
config :swoosh, local: false
Expand All @@ -24,7 +24,7 @@ config :logger, level: :info
# so it runs in parallel with the rest of our Docker steps and can be cache’d easily.
# Then we told Rustler to skip compiling and to load it directly from our where we put it.
# See https://fly.io/phoenix-files/elixir-and-rust-is-a-good-mix/
config :collaborative_drawing, YsCrdt,
config :mapcanv, YsCrdt,
crate: :yscrdt,
skip_compilation?: true,
load_from: {:collaborative_drawing, "priv/native/libyscrdt"}
load_from: {:mapcanv, "priv/native/libyscrdt"}
Loading

0 comments on commit 27224c0

Please sign in to comment.