Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/build-canary-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.repository }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-frontend:
runs-on: ubuntu-latest
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Please

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Check release token
env:
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
run: |
if [ -z "$RELEASE_PLEASE_TOKEN" ]; then
echo "RELEASE_PLEASE_TOKEN must be set to a fine-grained PAT so release-please tags can trigger release.yml." >&2
exit 1
fi

- name: Run release-please
uses: googleapis/release-please-action@v4
with:
# Use a fine-grained PAT so generated tags trigger release.yml.
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
GO_VERSION: "1.26.1"
NODE_VERSION: "24"
Expand Down Expand Up @@ -243,7 +246,6 @@ jobs:
with:
tag_name: ${{ needs.prepare.outputs.tag }}
name: ${{ needs.prepare.outputs.tag }}
generate_release_notes: true
prerelease: ${{ needs.prepare.outputs.is_prerelease == 'true' }}
files: artifacts/*

Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.26.2"
}
35 changes: 35 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"bump-minor-pre-major": true,
"packages": {
".": {
"release-type": "go",
"package-name": "memos",
"changelog-path": "CHANGELOG.md",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "revert",
"section": "Reverts"
}
]
}
}
}
4 changes: 2 additions & 2 deletions web/src/components/MemoMetadata/Location/LocationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const LocationDialog = ({

return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-[min(28rem,calc(100vw-2rem))] p-0!">
<DialogContent className="max-w-[min(28rem,calc(100vw-2rem))] p-0!" showCloseButton={false}>
<VisuallyHidden>
<DialogClose />
</VisuallyHidden>
Expand All @@ -47,7 +47,7 @@ export const LocationDialog = ({
</VisuallyHidden>
<div className="flex flex-col">
<div className="w-full h-64 overflow-hidden rounded-t-md bg-muted/30">
<LocationPicker latlng={position} onChange={onPositionChange} />
<LocationPicker className="h-full" latlng={position} onChange={onPositionChange} />
</div>
<div className="w-full flex flex-col p-3 gap-3">
<div className="grid grid-cols-2 gap-3">
Expand Down
45 changes: 25 additions & 20 deletions web/src/components/map/LocationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ import { MapContainer, Marker, useMap, useMapEvents } from "react-leaflet";
import { cn } from "@/lib/utils";
import { defaultMarkerIcon, ThemedTileLayer } from "./map-utils";

interface MarkerProps {
interface LocationMarkerProps {
position: LatLng | undefined;
onChange: (position: LatLng) => void;
readonly?: boolean;
}

const LocationMarker = (props: MarkerProps) => {
const [position, setPosition] = useState(props.position);
const LocationMarker = ({ position: initialPosition, onChange, readonly: readOnly }: LocationMarkerProps) => {
const [position, setPosition] = useState(initialPosition);
const initializedRef = useRef(false);

const map = useMapEvents({
click(e) {
if (props.readonly) {
if (readOnly) {
return;
}

setPosition(e.latlng);
map.locate();
// Call the parent onChange function.
props.onChange(e.latlng);
onChange(e.latlng);
},
locationfound() {},
});
Expand All @@ -37,15 +36,14 @@ const LocationMarker = (props: MarkerProps) => {
}
}, [map]);

// Keep marker and map in sync with external position updates
useEffect(() => {
if (props.position) {
setPosition(props.position);
map.setView(props.position);
if (initialPosition) {
setPosition(initialPosition);
map.setView(initialPosition);
} else {
setPosition(undefined);
}
}, [props.position, map]);
}, [initialPosition, map]);

return position === undefined ? null : <Marker position={position} icon={defaultMarkerIcon}></Marker>;
};
Expand Down Expand Up @@ -197,31 +195,38 @@ const MapCleanup = () => {
return null;
};

interface MapProps {
interface LocationPickerProps {
readonly?: boolean;
latlng?: LatLng;
onChange?: (position: LatLng) => void;
className?: string;
}

const DEFAULT_CENTER_LAT_LNG = new LatLng(48.8584, 2.2945);
const noopOnLocationChange = () => {};

const LeafletMap = (props: MapProps) => {
const position = props.latlng || DEFAULT_CENTER_LAT_LNG;
const statusLabel = props.readonly ? "Pinned location" : props.latlng ? "Selected location" : "Choose a location";
const LocationPicker = ({ readonly: readOnly = false, latlng, onChange = noopOnLocationChange, className }: LocationPickerProps) => {
const position = latlng || DEFAULT_CENTER_LAT_LNG;
const statusLabel = readOnly ? "Pinned location" : latlng ? "Selected location" : "Choose a location";

return (
<div className="memo-location-map relative isolate w-full overflow-hidden rounded-xl border border-border bg-background shadow-sm">
<div
className={cn(
"memo-location-map relative isolate h-72 w-full overflow-hidden rounded-xl border border-border bg-background shadow-sm",
className,
)}
>
<MapContainer
className="h-72 w-full !bg-muted"
className="h-full w-full !bg-muted"
center={position}
zoom={13}
scrollWheelZoom={false}
zoomControl={false}
attributionControl={false}
>
<ThemedTileLayer />
<LocationMarker position={position} readonly={props.readonly} onChange={props.onChange ? props.onChange : () => {}} />
<MapControls position={props.latlng} />
<LocationMarker position={position} readonly={readOnly} onChange={onChange} />
<MapControls position={latlng} />
<MapCleanup />
</MapContainer>

Expand All @@ -234,4 +239,4 @@ const LeafletMap = (props: MapProps) => {
);
};

export default LeafletMap;
export default LocationPicker;
2 changes: 1 addition & 1 deletion web/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"basic": "Base",
"beta": "Beta",
"calendar": "Calendario",
"cancel": "Cancella",
"cancel": "Annulla",
"change": "Cambia",
"clear": "Pulisci",
"close": "Chiudi",
Expand Down
15 changes: 14 additions & 1 deletion web/src/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ const updateThemeColorMeta = (theme: ResolvedTheme): void => {
}
};

const isDarkTheme = (theme: ResolvedTheme): boolean => {
return theme.endsWith("-dark") || theme.endsWith(".dark");
};

/**
* Updates the browser native control color scheme to match the current theme.
*/
const updateColorScheme = (theme: ResolvedTheme): void => {
document.documentElement.style.colorScheme = isDarkTheme(theme) ? "dark" : "light";
};

// ============================================================================
// Main Theme Loading
// ============================================================================
Expand All @@ -193,7 +204,8 @@ const updateThemeColorMeta = (theme: ResolvedTheme): void => {
* 2. Resolves "system" to actual theme
* 3. Injects theme CSS
* 4. Sets data-theme attribute
* 5. Persists to localStorage
* 5. Updates browser native UI colors
* 6. Persists to localStorage
*/
export const loadTheme = (themeName: string): void => {
const validTheme = validateTheme(themeName);
Expand All @@ -202,6 +214,7 @@ export const loadTheme = (themeName: string): void => {
injectThemeStyle(resolvedTheme);
setThemeAttribute(resolvedTheme);
updateThemeColorMeta(resolvedTheme);
updateColorScheme(resolvedTheme);
setStoredTheme(validTheme); // Store original theme preference (not resolved)
};

Expand Down
Loading