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

Report btn #241

Merged
merged 9 commits into from
Jun 12, 2024
Merged

Report btn #241

merged 9 commits into from
Jun 12, 2024

Conversation

komal-sai-yral
Copy link
Contributor

No description provided.

Copy link
Contributor

@rupansh-sekar-yral rupansh-sekar-yral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit + minor change

}

impl ReportOption {
pub fn as_str(&self) -> &'static str {
Copy link
Contributor

@rupansh-sekar-yral rupansh-sekar-yral Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: impl Display makes more sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facing issue when I am using it here with impl Display.

#[component]
pub fn SelectOption(is: &'static str, value: ReadSignal<String>) -> impl IntoView {
    view! {
        <option
            value=is
            selected=move || value() == is
        >
            {is}
        </option>
    }
}

Copy link
Contributor

@rupansh-sekar-yral rupansh-sekar-yral Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does #[prop(into)] is: String work with display?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

let off_chain_agent_url = OFF_CHAIN_AGENT_GRPC_URL.as_ref();
let channel = Channel::from_static(off_chain_agent_url).connect().await?;

let mut off_chain_agent_grpc_auth_token = env::var("GRPC_AUTH_TOKEN").expect("GRPC_AUTH_TOKEN");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we migrate off chain client to AppState instead of constructing every time?
https://github.com/go-bazzinga/hot-or-not-web-leptos-ssr/blob/main/src/state/mod.rs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@rupansh-sekar-yral rupansh-sekar-yral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure running locally without off chain agent is possible

src/main.rs Outdated
@@ -35,6 +37,8 @@ pub async fn server_fn_handler(
provide_context(app_state.cookie_key.clone());
#[cfg(feature = "oauth-ssr")]
provide_context(app_state.google_oauth.clone());
#[cfg(feature = "ssr")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be behind ga4 feature flag no?
main.rs already implies ssr

src/main.rs Outdated
Comment on lines 19 to 20
#[cfg(feature = "ssr")]
use tonic::transport::Channel;
Copy link
Contributor

@rupansh-sekar-yral rupansh-sekar-yral Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually put these import inside the scope or use absolute imports so we don't add an extra #[cfg] block

See https://github.com/go-bazzinga/hot-or-not-web-leptos-ssr/blob/main/src/main.rs#L113

@@ -28,5 +29,6 @@ pub mod server {
pub cookie_key: Key,
#[cfg(feature = "oauth-ssr")]
pub google_oauth: openidconnect::core::CoreClient,
pub grpc_offchain_channel: Channel,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ga4 feature flag

}

#[server]
pub async fn send_report_offchain(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add a mock (or make reporting no-op locally)

@komal-sai-yral komal-sai-yral merged commit e08a7aa into main Jun 12, 2024
3 checks passed
@komal-sai-yral komal-sai-yral deleted the report-btn branch June 12, 2024 12:14
abhishek-tripathi-yral pushed a commit that referenced this pull request Jun 17, 2024
* report button

* report btn

* clippfy fixes

* build fix

* common client

* common client in both

* clippy fix

* review changes

* review changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants