pub const BASE_URL: &str = "https://rewordsai.app";
pub fn home_url() -> &'static str {
BASE_URL
}
pub fn tool_url(slug: &str) -> String {
let clean = slug.trim_matches('/');
if clean.is_empty() {
BASE_URL.to_string()
} else {
format!("{BASE_URL}/{clean}")
}
}
pub fn tools_url() -> String { tool_url("tools") }
pub fn edit_text_in_image_url() -> String { tool_url("edit-text-in-image") }
pub fn replace_text_in_image_url() -> String { tool_url("replace-text-in-image") }
pub fn remove_text_from_image_url() -> String { tool_url("remove-text-from-image") }
pub fn photo_text_editor_url() -> String { tool_url("photo-text-editor") }
pub fn translate_text_in_image_url() -> String { tool_url("translate-text-in-image") }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn builds_links() {
assert_eq!(home_url(), "https://rewordsai.app");
assert_eq!(tools_url(), "https://rewordsai.app/tools");
assert_eq!(edit_text_in_image_url(), "https://rewordsai.app/edit-text-in-image");
assert_eq!(replace_text_in_image_url(), "https://rewordsai.app/replace-text-in-image");
assert_eq!(remove_text_from_image_url(), "https://rewordsai.app/remove-text-from-image");
assert_eq!(photo_text_editor_url(), "https://rewordsai.app/photo-text-editor");
assert_eq!(translate_text_in_image_url(), "https://rewordsai.app/translate-text-in-image");
}
}